Compare commits

..

30 Commits

Author SHA1 Message Date
Alexander Afanasyev 26c785f7f4 flow-monitor: Correcting usage of new PacketTag API 2012-05-31 16:11:10 -07:00
Alexander Afanasyev c36547fb62 network: Correcting test cases for new PacketTag API 2012-05-31 16:11:10 -07:00
Alexander Afanasyev a7ec40805a network+all: Changing all cases of PacketTag API usage (source, examples, and tests) 2012-05-31 16:11:10 -07:00
Alexander Afanasyev f8ba98843a network: !!! Change PacketTag API !!! 2012-05-31 16:11:10 -07:00
Alexander Afanasyev c5037d1594 visualizer: Fix dependency on ns3.lte/virtual_net_device 2012-05-31 16:11:09 -07:00
Alexander Afanasyev 613a332306 internet: Corrections of RttEstimator:
Introducing RTO upper bound
Introducing gain2 for smoothing the variance
Making RTO calculation according to the RFC

For future: may need to calculate RTO as in linux implementation
2012-05-31 16:11:09 -07:00
Alexander Afanasyev e474e93667 point-to-point: Making loss (again) independent on packet type 2012-05-31 16:11:09 -07:00
Alexander Afanasyev 6ea2a97ca0 point-to-point: Add experimental support for random losses 2012-05-31 16:11:09 -07:00
Alexander Afanasyev fe9a8cca8e internet: rescanned bindings and small modification 2012-05-31 16:11:09 -07:00
Alexander Afanasyev b1ec1fde9a internet: Solving very serious bug in Ipv4GlobalRoutingHelper
Somehow, the metric values for "disabled faces" in
PopulateAllPossibleRoutingTables function were set to random values,
instead of UINT16_MAX.  This caused a lot of unexpected thing that were
hard to track down.
2012-05-31 16:11:09 -07:00
Alexander Afanasyev b26d351756 internet: Repairing GlobalRouting lookup 2012-05-31 16:11:09 -07:00
Alexander Afanasyev 8a0c45ea89 internet: Adding necessary methods to implement alternative-interface global routing table 2012-05-31 16:11:09 -07:00
Alexander Afanasyev 10c2679ebf internet: Updating global routing controller 2012-05-31 16:11:09 -07:00
Alexander Afanasyev 9615e4936d internet: Disable host routes in GlobalRouteManagerImpl. All of them are covered by stub LSAs 2012-05-31 16:11:08 -07:00
Alexander Afanasyev 14b5c3bb39 internet+network: Ipv4GlobalRouting is rewritten to use PATRICIA Trie lookups.
Trie implementation is based on gcc libstc++ pb_ds extension.

! Attention ! ECMP link randomization in Ipv4GlobalRouting is broken at
the moment. Such (similar) possibility will be implemented in different
place.
2012-05-31 16:11:08 -07:00
Alexander Afanasyev bfa8e6db50 point-to-point, netanim: Adding ChannelID to PointToPointChannel trace 2012-05-31 16:11:08 -07:00
Alexander Afanasyev b81d969ba3 visualizer: temporary fix for the visualizer-related bugs (asserts) 2012-05-31 16:11:08 -07:00
Alexander Afanasyev 7b321fba3e network: Adding Read (Buffer::Iterator start, uint32_t size) and PeakU8 methods to ns3::Buffer::Iterator class 2012-05-31 16:11:08 -07:00
Alexander Afanasyev 19a649bbe2 internet: A new templated static method Ipv(4|6)RoutingHelper::GetRouting that allows search for any routing protocol
Examples:
Ptr<Ipv4RoutingProtocol> ptr = ...

...

Ptr<Ipv4StaticRouting> sr = Ipv4RoutingHelper::GetRouting<Ipv4StaticRouting> (ptr);
2012-05-31 16:11:08 -07:00
Alexander Afanasyev 27e2cbc0d9 core+openflow: Moving boost-related configuration to main wscript.
There is a problem when two different modules require different boost
libs.  Only requirements of the last module are actually picked up by
the build system.
2012-05-31 16:11:08 -07:00
Alexander Afanasyev c8d890d17c visualizer: Making a periodic topology rescan 2012-05-31 16:11:08 -07:00
Alexander Afanasyev b7874cc528 visualizer: Adding plugin to display a CCNx FIB state 2012-05-31 16:11:08 -07:00
Alexander Afanasyev c26183766b core: Adding inline specifiers for DoMakeAttributeAccessor (there was a
strange duplicate symbols error using apple compiler...)
2012-05-31 16:11:08 -07:00
Alexander Afanasyev 8fd5b780c3 internet: Making rtt-estimator.h of the Internet module accessible to other modules 2012-05-31 15:40:04 -07:00
Alexander Afanasyev 9cb65dfc01 core: Small extension of Vector class (math operations) 2012-05-31 15:40:04 -07:00
Alexander Afanasyev 0d6945be98 topology-read: Making default constructor for TopologyReader::Link public.
This is necessary for some STL containers operations.
2012-05-31 15:40:04 -07:00
Alexander Afanasyev b28ffde9d5 topology-read: TopologyReader and derivatives are no longer Objects
To allow smart pointers, TopologyReader is just inherited from
SimpleRefCount<TopologyReader> class
2012-05-31 15:40:04 -07:00
Alexander Afanasyev d824a1339b topology-read: Several extensions of TopologyReader 2012-05-31 15:40:04 -07:00
Ilya Moiseenko 8cca1f7e34 point-to-point: Add support of PPP->Ethernet and Ethernet->PPP frame type conversion for CCNx protocol
point-to-point: Adding support for CCNx payload in PppHeader::Print method
2012-05-31 15:40:04 -07:00
Alexander Afanasyev cb0af6394c Adding .gitignore 2012-05-31 15:40:04 -07:00
117 changed files with 2510 additions and 9441 deletions
+2 -1
View File
@@ -45,4 +45,5 @@ massif.*
\#[^\#/]+\#$
.lock-wscript
.lock-wafbuild
*~
\#*\#
-1
View File
@@ -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
+10 -11
View File
@@ -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 -24
View File
@@ -44,30 +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></li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
<li></li>
</ul>
<h2>Changes to build system:</h2>
<ul>
<li></li>
</ul>
<h2>Changed behavior:</h2>
<ul>
<li></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>
-6
View File
@@ -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 -50
View File
@@ -9,73 +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
-------------------------
Bugs fixed
----------
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
@@ -87,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",
@@ -95,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
@@ -140,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
------------
-1
View File
@@ -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 \
+1
View File
@@ -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
-1
View File
@@ -7,4 +7,3 @@ Network Module
network-overview
sockets-api
simple
queue
+76 -92
View File
@@ -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/
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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.
+10 -12
View File
@@ -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
+1 -1
View File
@@ -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',
+7 -7
View File
@@ -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'])
+7 -8
View File
@@ -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;
+2 -2
View File
@@ -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 */
+2 -1
View File
@@ -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;
+6 -26
View File
@@ -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
**********
+6 -8
View File
@@ -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
View File
@@ -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
+1 -2
View File
@@ -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 -1
View File
@@ -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'
+10 -13
View File
@@ -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
<< "); ");
+130 -241
View File
@@ -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
+130 -241
View File
@@ -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
@@ -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
+5 -5
View File
@@ -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;
}
}
+186 -153
View File
@@ -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 <<
@@ -715,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.
+18 -1
View File
@@ -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.
+80 -79
View File
@@ -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;
}
+29 -36
View File
@@ -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);
+1 -1
View File
@@ -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);
+5 -5
View File
@@ -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 */
+6 -496
View File
@@ -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)
{
+15 -155
View File
@@ -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
+3 -4
View File
@@ -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:
+4 -3
View File
@@ -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)
+50 -22
View File
@@ -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;
}
+28 -9
View File
@@ -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 -33
View File
@@ -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
+5 -5
View File
@@ -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,
+3 -4
View File
@@ -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:
+3 -3
View File
@@ -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);
}
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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));
+81 -80
View File
@@ -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);
}
+2 -5
View File
@@ -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;
}
+68 -69
View File
@@ -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
+3
View File
@@ -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',
+4 -4
View File
@@ -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::
-4
View File
@@ -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>`_
+2 -2
View File
@@ -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 95% confidence interval 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 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
+2 -15
View File
@@ -727,26 +727,13 @@ That's all! You can now start your simulation as usual::
Simulator::Run ();
Examples Programs
-----------------
Further Reading
---------------
The directory ``src/lte/examples/`` contains some example simulation programs that
show how to simulate different LTE scenarios.
Reference scenarios
-------------------
There is a vast amount of reference LTE simulation scenarios which can be found in the literature. Here we list some of them:
* The dual stripe model [R4-092042]_, which is partially implemented in the example program ``src/lte/examples/lena-dual-stripe.cc``
* The system simulation scenarios mentioned in section A.2 of [TR36814]_
+1 -1
View File
@@ -447,7 +447,7 @@ LteEnbPhy::StartSubFrame (void)
{
std::map <uint16_t, Ptr<LteUePhy> >::iterator it2;
Ptr<UlDciIdealControlMessage> dci = DynamicCast<UlDciIdealControlMessage> (msg);
// QueueUlDci (*dci);
QueueUlDci (*dci);
it2 = m_ueAttached.find (dci->GetDci ().m_rnti);
if (it2 == m_ueAttached.end ())
+2 -3
View File
@@ -507,7 +507,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched
// no info on this subband -> worst MCS
mcs = 0;
}
achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, rbgSize) / 8) / 0.001); // = TB size / TTI
achievableRate += ((m_amc->GetTbSizeFromMcs (mcs, 1) / 8) / 0.001); // = TB size / TTI
}
double rcqi = achievableRate / (*it).second.lastAveragedThroughput;
@@ -1191,7 +1191,6 @@ PfFfMacScheduler::RefreshUlCqiMaps(void)
void
PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
{
size = size - 2; // remove the minimum RLC overhead
std::map<LteFlowId_t, FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
LteFlowId_t flow (rnti, lcid);
it = m_rlcBufferReq.find (flow);
@@ -1243,7 +1242,7 @@ void
PfFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
{
size = size - 2; // remove the minimum RLC overhead
std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
if (it!=m_ceBsrRxed.end ())
{
+1 -2
View File
@@ -972,7 +972,6 @@ RrFfMacScheduler::RefreshUlCqiMaps(void)
void
RrFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t size)
{
size = size - 2; // remove the minimum RLC overhead
std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
{
@@ -1022,7 +1021,7 @@ void
RrFfMacScheduler::UpdateUlRlcBufferInfo (uint16_t rnti, uint16_t size)
{
size = size - 2; // remove the minimum RLC overhead
std::map <uint16_t,uint32_t>::iterator it = m_ceBsrRxed.find (rnti);
if (it!=m_ceBsrRxed.end ())
{
+9 -10
View File
@@ -55,8 +55,7 @@ HwmpProtocolMac::ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header)
NS_ASSERT (header.IsData ());
MeshHeader meshHdr;
HwmpTag tag;
if (packet->PeekPacketTag (tag))
if (packet->PeekPacketTag<HwmpTag> () != 0)
{
NS_FATAL_ERROR ("HWMP tag is not supposed to be received by network");
}
@@ -78,8 +77,9 @@ HwmpProtocolMac::ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header)
NS_FATAL_ERROR (
"6-address scheme is not yet supported and 4-address extension is not supposed to be used for data frames.");
}
tag.SetSeqno (meshHdr.GetMeshSeqno ());
tag.SetTtl (meshHdr.GetMeshTtl ());
Ptr<HwmpTag> tag = CreateObject<HwmpTag> ();
tag->SetSeqno (meshHdr.GetMeshSeqno ());
tag->SetTtl (meshHdr.GetMeshTtl ());
packet->AddPacketTag (tag);
if ((destination == Mac48Address::GetBroadcast ()) && (m_protocol->DropDataFrame (meshHdr.GetMeshSeqno (),
@@ -188,19 +188,18 @@ HwmpProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & heade
{
return true;
}
HwmpTag tag;
bool tagExists = packet->RemovePacketTag (tag);
if (!tagExists)
Ptr<const HwmpTag> tag = packet->RemovePacketTag<HwmpTag> ();
if (tag == 0)
{
NS_FATAL_ERROR ("HWMP tag must exist at this point");
}
m_stats.txData++;
m_stats.txDataBytes += packet->GetSize ();
MeshHeader meshHdr;
meshHdr.SetMeshSeqno (tag.GetSeqno ());
meshHdr.SetMeshTtl (tag.GetTtl ());
meshHdr.SetMeshSeqno (tag->GetSeqno ());
meshHdr.SetMeshTtl (tag->GetTtl ());
packet->AddHeader (meshHdr);
header.SetAddr1 (tag.GetAddress ());
header.SetAddr1 (tag->GetAddress ());
return true;
}
WifiActionHeader
+29 -21
View File
@@ -233,29 +233,32 @@ HwmpProtocol::RequestRoute (
)
{
Ptr <Packet> packet = constPacket->Copy ();
HwmpTag tag;
Ptr<HwmpTag> tag = 0;
if (sourceIface == GetMeshPoint ()->GetIfIndex ())
{
// packet from level 3
if (packet->PeekPacketTag (tag))
if (packet->PeekPacketTag<HwmpTag> () != 0)
{
NS_FATAL_ERROR ("HWMP tag has come with a packet from upper layer. This must not occur...");
}
tag = CreateObject<HwmpTag> ();
//Filling TAG:
if (destination == Mac48Address::GetBroadcast ())
{
tag.SetSeqno (m_dataSeqno++);
tag->SetSeqno (m_dataSeqno++);
}
tag.SetTtl (m_maxTtl);
tag->SetTtl (m_maxTtl);
}
else
{
if (!packet->RemovePacketTag (tag))
Ptr<const HwmpTag> origTag = packet->RemovePacketTag<HwmpTag> ();
if (!packet->RemovePacketTag<HwmpTag> ())
{
NS_FATAL_ERROR ("HWMP tag is supposed to be here at this point.");
}
tag.DecrementTtl ();
if (tag.GetTtl () == 0)
tag = CreateObject<HwmpTag> (*origTag);
tag->DecrementTtl ();
if (tag->GetTtl () == 0)
{
m_stats.droppedTtl++;
return false;
@@ -287,11 +290,11 @@ HwmpProtocol::RequestRoute (
{
Ptr<Packet> packetCopy = packet->Copy ();
//
// 64-bit Intel valgrind complains about tag.SetAddress (*i). It
// 64-bit Intel valgrind complains about tag->SetAddress (*i). It
// likes this just fine.
//
Mac48Address address = *i;
tag.SetAddress (address);
tag->SetAddress (address);
packetCopy->AddPacketTag (tag);
routeReply (true, packetCopy, source, destination, protocolType, plugin->first);
}
@@ -299,7 +302,7 @@ HwmpProtocol::RequestRoute (
}
else
{
return ForwardUnicast (sourceIface, source, destination, packet, protocolType, routeReply, tag.GetTtl ());
return ForwardUnicast (sourceIface, source, destination, packet, protocolType, routeReply, tag->GetTtl ());
}
return true;
}
@@ -307,8 +310,8 @@ bool
HwmpProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source,
const Mac48Address destination, Ptr<Packet> packet, uint16_t& protocolType)
{
HwmpTag tag;
if (!packet->RemovePacketTag (tag))
Ptr<const HwmpTag> tag = packet->RemovePacketTag<HwmpTag> ();
if (tag == 0)
{
NS_FATAL_ERROR ("HWMP tag must exist when packet received from the network");
}
@@ -325,9 +328,9 @@ HwmpProtocol::ForwardUnicast (uint32_t sourceIface, const Mac48Address source,
{
result = m_rtable->LookupProactive ();
}
HwmpTag tag;
tag.SetAddress (result.retransmitter);
tag.SetTtl (ttl);
Ptr<HwmpTag> tag = CreateObject<HwmpTag> ();
tag->SetAddress (result.retransmitter);
tag->SetTtl (ttl);
//seqno and metric is not used;
packet->AddPacketTag (tag);
if (result.retransmitter != Mac48Address::GetBroadcast ())
@@ -921,9 +924,13 @@ HwmpProtocol::ReactivePathResolved (Mac48Address dst)
while (packet.pkt != 0)
{
//set RA tag for retransmitter:
HwmpTag tag;
packet.pkt->RemovePacketTag (tag);
tag.SetAddress (result.retransmitter);
Ptr<const HwmpTag> origTag = packet.pkt->RemovePacketTag<HwmpTag> ();
if (origTag == 0)
{
NS_FATAL_ERROR ("HWMP tag must be present at this point");
}
Ptr<HwmpTag> tag = CreateObject<HwmpTag> (*origTag);
tag->SetAddress (result.retransmitter);
packet.pkt->AddPacketTag (tag);
m_stats.txUnicast++;
m_stats.txBytes += packet.pkt->GetSize ();
@@ -942,12 +949,13 @@ HwmpProtocol::ProactivePathResolved ()
while (packet.pkt != 0)
{
//set RA tag for retransmitter:
HwmpTag tag;
if (!packet.pkt->RemovePacketTag (tag))
Ptr<const HwmpTag> origTag = packet.pkt->RemovePacketTag<HwmpTag> ();
if (origTag == 0)
{
NS_FATAL_ERROR ("HWMP tag must be present at this point");
}
tag.SetAddress (result.retransmitter);
Ptr<HwmpTag> tag = CreateObject<HwmpTag> (*origTag);
tag->SetAddress (result.retransmitter);
packet.pkt->AddPacketTag (tag);
m_stats.txUnicast++;
m_stats.txBytes += packet.pkt->GetSize ();
+4 -4
View File
@@ -41,7 +41,7 @@ HwmpTag::SetAddress (Mac48Address retransmitter)
}
Mac48Address
HwmpTag::GetAddress ()
HwmpTag::GetAddress () const
{
return m_address;
}
@@ -53,7 +53,7 @@ HwmpTag::SetTtl (uint8_t ttl)
}
uint8_t
HwmpTag::GetTtl ()
HwmpTag::GetTtl () const
{
return m_ttl;
}
@@ -65,7 +65,7 @@ HwmpTag::SetMetric (uint32_t metric)
}
uint32_t
HwmpTag::GetMetric ()
HwmpTag::GetMetric () const
{
return m_metric;
}
@@ -77,7 +77,7 @@ HwmpTag::SetSeqno (uint32_t seqno)
}
uint32_t
HwmpTag::GetSeqno ()
HwmpTag::GetSeqno () const
{
return m_seqno;
}
+4 -4
View File
@@ -51,13 +51,13 @@ public:
HwmpTag ();
~HwmpTag ();
void SetAddress (Mac48Address retransmitter);
Mac48Address GetAddress ();
Mac48Address GetAddress () const;
void SetTtl (uint8_t ttl);
uint8_t GetTtl ();
uint8_t GetTtl () const;
void SetMetric (uint32_t metric);
uint32_t GetMetric ();
uint32_t GetMetric () const;
void SetSeqno (uint32_t seqno);
uint32_t GetSeqno ();
uint32_t GetSeqno () const;
void DecrementTtl ();
static TypeId GetTypeId ();
+9 -9
View File
@@ -47,14 +47,14 @@ FlameProtocolMac::Receive (Ptr<Packet> packet, const WifiMacHeader & header)
{
return true;
}
FlameTag tag;
if (packet->PeekPacketTag (tag))
if (packet->PeekPacketTag<FlameTag> () != 0)
{
NS_FATAL_ERROR ("FLAME tag is not supposed to be received by network");
}
tag.receiver = header.GetAddr1 ();
tag.transmitter = header.GetAddr2 ();
if (tag.receiver == Mac48Address::GetBroadcast ())
Ptr<FlameTag> tag = CreateObject<FlameTag> ();
tag->receiver = header.GetAddr1 ();
tag->transmitter = header.GetAddr2 ();
if (tag->receiver == Mac48Address::GetBroadcast ())
{
m_stats.rxBroadcast++;
}
@@ -74,13 +74,13 @@ FlameProtocolMac::UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & head
{
return true;
}
FlameTag tag;
if (!packet->RemovePacketTag (tag))
Ptr<const FlameTag> tag = packet->RemovePacketTag<FlameTag> ();
if (tag == 0)
{
NS_FATAL_ERROR ("FLAME tag must exist here");
}
header.SetAddr1 (tag.receiver);
if (tag.receiver == Mac48Address::GetBroadcast ())
header.SetAddr1 (tag->receiver);
if (tag->receiver == Mac48Address::GetBroadcast ())
{
m_stats.txBroadcast++;
}
+18 -16
View File
@@ -150,8 +150,7 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
if (sourceIface == m_mp->GetIfIndex ())
{
//Packet from upper layer!
FlameTag tag;
if (packet->PeekPacketTag (tag))
if (packet->PeekPacketTag<FlameTag> () != 0)
{
NS_FATAL_ERROR ("FLAME tag is not supposed to be received from upper layers");
}
@@ -174,7 +173,8 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
flameHdr.SetOrigSrc (source);
m_stats.txBytes += packet->GetSize ();
packet->AddHeader (flameHdr);
tag.receiver = result.retransmitter;
Ptr<FlameTag> tag = CreateObject<FlameTag> ();
tag->receiver = result.retransmitter;
if (result.retransmitter == Mac48Address::GetBroadcast ())
{
m_stats.txBroadcast++;
@@ -183,7 +183,7 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
{
m_stats.txUnicast++;
}
NS_LOG_DEBUG ("Source: send packet with RA = " << tag.receiver);
NS_LOG_DEBUG ("Source: send packet with RA = " << tag->receiver);
packet->AddPacketTag (tag);
routeReply (true, packet, source, destination, FLAME_PROTOCOL, result.ifIndex);
}
@@ -191,17 +191,18 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
{
FlameHeader flameHdr;
packet->RemoveHeader (flameHdr);
FlameTag tag;
if (!packet->RemovePacketTag (tag))
Ptr<const FlameTag> origTag = packet->RemovePacketTag<FlameTag> ();
if (origTag == 0)
{
NS_FATAL_ERROR ("FLAME tag must exist here");
}
if (destination == Mac48Address::GetBroadcast ())
{
//Broadcast always is forwarded as broadcast!
NS_ASSERT (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface));
FlameTag tag (Mac48Address::GetBroadcast ());
NS_ASSERT (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, origTag->transmitter, sourceIface));
Ptr<FlameTag> tag = CreateObject<FlameTag> (Mac48Address::GetBroadcast ());
flameHdr.AddCost (1);
m_stats.txBytes += packet->GetSize ();
packet->AddHeader (flameHdr);
@@ -212,27 +213,28 @@ FlameProtocol::RequestRoute (uint32_t sourceIface, const Mac48Address source, co
}
else
{
Ptr<FlameTag> tag = CreateObject<FlameTag> (*origTag);
// We check sequence only when forward unicast, because broadcast-checks were done
// inside remove routing stuff.
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, sourceIface))
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag->transmitter, sourceIface))
{
return false;
}
FlameRtable::LookupResult result = m_rtable->Lookup (destination);
if (tag.receiver != Mac48Address::GetBroadcast ())
if (origTag->receiver != Mac48Address::GetBroadcast ())
{
if (result.retransmitter == Mac48Address::GetBroadcast ())
{
NS_LOG_DEBUG ("unicast packet dropped, because no route! I am " << GetAddress ()
<< ", RA = " << tag.receiver << ", TA = " << tag.transmitter);
<< ", RA = " << origTag->receiver << ", TA = " << origTag->transmitter);
m_stats.totalDropped++;
return false;
}
tag.receiver = result.retransmitter;
tag->receiver = result.retransmitter;
}
else
{
tag.receiver = Mac48Address::GetBroadcast ();
tag->receiver = Mac48Address::GetBroadcast ();
}
if (result.retransmitter == Mac48Address::GetBroadcast ())
{
@@ -263,14 +265,14 @@ FlameProtocol::RemoveRoutingStuff (uint32_t fromIface, const Mac48Address source
NS_LOG_DEBUG ("Dropped my own frame!");
return false;
}
FlameTag tag;
if (!packet->RemovePacketTag (tag))
Ptr<const FlameTag> tag = packet->RemovePacketTag <FlameTag> ();
if (tag == 0)
{
NS_FATAL_ERROR ("FLAME tag must exist when packet is coming to protocol");
}
FlameHeader flameHdr;
packet->RemoveHeader (flameHdr);
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag.transmitter, fromIface))
if (HandleDataFrame (flameHdr.GetSeqno (), source, flameHdr, tag->transmitter, fromIface))
{
return false;
}
+5 -5
View File
@@ -222,15 +222,15 @@ MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address
//Classify: application sets a tag, which is removed here
// Get Qos tag:
AcIndex ac = AC_BE;
QosTag tag;
if (packet->RemovePacketTag (tag))
Ptr<const QosTag> tag = packet->RemovePacketTag<QosTag> ();
if (tag != 0)
{
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosTid (tag.GetTid ());
hdr.SetQosTid (tag->GetTid ());
//Aftre setting type DsFrom and DsTo fields are reset.
hdr.SetDsFrom ();
hdr.SetDsTo ();
ac = QosUtilsMapTidToAc (tag.GetTid ());
ac = QosUtilsMapTidToAc (tag->GetTid ());
}
m_stats.sentFrames++;
m_stats.sentBytes += packet->GetSize ();
@@ -446,7 +446,7 @@ MeshWifiInterfaceMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr)
// Check if QoS tag exists and add it:
if (hdr->IsQosData ())
{
packet->AddPacketTag (QosTag (hdr->GetQosTid ()));
packet->AddPacketTag (CreateObject<QosTag> (hdr->GetQosTid ()));
}
// Forward data up
if (hdr->IsData ())
-301
View File
@@ -1,301 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Andrea Sacco
*
* 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: Andrea Sacco <andrea.sacco85@gmail.com>
*/
/**
* \file uan-animation.cc
* \ingroup uan
*
* This example showcases the "CW-MAC" described in System Design Considerations for Undersea Networks
* article in the IEEE Journal on Selected Areas of Communications 2008 by Nathan Parrish, Leonard Tracy
* and Sumit Roy. The MAC protocol is implemented in the class UanMacCw. CW-MAC is similar in nature
* to the IEEE 802.11 DCF with a constant backoff window. It requires two parameters to be set,
* the slot time and the contention window size. The contention window size is the backoff window
* size in slots, and the slot time is the duration of each slot. These parameters should be set
* according to the overall network size, internode spacing and the number of nodes in the network.
*
* This example deploys nodes randomly (according to RNG seed of course) in a finite square region with
* the X and Y coordinates of the nodes distributed uniformly. The CW parameter is varied throughout
* the simulation in order to show the variation in throughput with respect to changes in CW.
*/
#include "uan-animation.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/netanim-module.h"
#include "ns3/mobility-module.h"
#include "ns3/tools-module.h"
#include "ns3/applications-module.h"
#include <fstream>
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("UanCwExample");
NetAnimExperiment::NetAnimExperiment ()
: m_numNodes (15),
m_dataRate (80),
m_depth (70),
m_boundary (500),
m_packetSize (32),
m_bytesTotal (0),
m_cwMin (10),
m_cwMax (400),
m_cwStep (10),
m_avgs (3),
m_slotTime (Seconds (0.2)),
m_simTime (Seconds (1000))
{
}
void
NetAnimExperiment::ResetData ()
{
NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Resetting data");
m_throughputs.push_back (m_bytesTotal * 8.0 / m_simTime.GetSeconds ());
m_bytesTotal = 0;
}
void
NetAnimExperiment::IncrementCw (uint32_t cw)
{
NS_ASSERT (m_throughputs.size () == m_avgs);
double avgThroughput = 0.0;
for (uint32_t i=0; i<m_avgs; i++)
{
avgThroughput += m_throughputs[i];
}
avgThroughput /= m_avgs;
m_throughputs.clear ();
Config::Set ("/NodeList/*/DeviceList/*/Mac/CW", UintegerValue (cw + m_cwStep));
SeedManager::SetRun (SeedManager::GetRun () + 1);
NS_LOG_DEBUG ("Average for cw=" << cw << " over " << m_avgs << " runs: " << avgThroughput);
}
void
NetAnimExperiment::UpdatePositions (NodeContainer &nodes)
{
NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Updating positions");
NodeContainer::Iterator it = nodes.Begin ();
UniformVariable uv (0, m_boundary);
for (; it != nodes.End (); it++)
{
Ptr<MobilityModel> mp = (*it)->GetObject<MobilityModel> ();
mp->SetPosition (Vector (uv.GetValue (), uv.GetValue (), 70.0));
}
}
void
NetAnimExperiment::ReceivePacket (Ptr<Socket> socket)
{
Ptr<Packet> packet;
while ((packet = socket->Recv ()))
{
m_bytesTotal += packet->GetSize ();
}
packet = 0;
}
void
NetAnimExperiment::Run (UanHelper &uan)
{
uan.SetMac ("ns3::UanMacCw", "CW", UintegerValue (m_cwMin), "SlotTime", TimeValue (m_slotTime));
NodeContainer nc = NodeContainer ();
NodeContainer sink = NodeContainer ();
nc.Create (m_numNodes);
sink.Create (1);
PacketSocketHelper socketHelper;
socketHelper.Install (nc);
socketHelper.Install (sink);
#ifdef UAN_PROP_BH_INSTALLED
Ptr<UanPropModelBh> prop = CreateObjectWithAttributes<UanPropModelBh> ("ConfigFile", StringValue ("exbhconfig.cfg"));
#else
Ptr<UanPropModelIdeal> prop = CreateObjectWithAttributes<UanPropModelIdeal> ();
#endif //UAN_PROP_BH_INSTALLED
Ptr<UanChannel> channel = CreateObjectWithAttributes<UanChannel> ("PropagationModel", PointerValue (prop));
//Create net device and nodes with UanHelper
NetDeviceContainer devices = uan.Install (nc, channel);
NetDeviceContainer sinkdev = uan.Install (sink, channel);
MobilityHelper mobility;
Ptr<ListPositionAllocator> pos = CreateObject<ListPositionAllocator> ();
{
UniformVariable urv (0, m_boundary);
pos->Add (Vector (m_boundary / 2.0, m_boundary / 2.0, m_depth));
double rsum = 0;
double minr = 2 * m_boundary;
for (uint32_t i = 0; i < m_numNodes; i++)
{
double x = urv.GetValue ();
double y = urv.GetValue ();
double newr = sqrt ((x - m_boundary / 2.0) * (x - m_boundary / 2.0)
+ (y - m_boundary / 2.0) * (y - m_boundary / 2.0));
rsum += newr;
minr = std::min (minr, newr);
pos->Add (Vector (x, y, m_depth));
}
NS_LOG_DEBUG ("Mean range from gateway: " << rsum / m_numNodes
<< " min. range " << minr);
mobility.SetPositionAllocator (pos);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (sink);
NS_LOG_DEBUG ("Position of sink: "
<< sink.Get (0)->GetObject<MobilityModel> ()->GetPosition ());
mobility.Install (nc);
PacketSocketAddress socket;
socket.SetSingleDevice (sinkdev.Get (0)->GetIfIndex ());
socket.SetPhysicalAddress (sinkdev.Get (0)->GetAddress ());
socket.SetProtocol (0);
OnOffHelper app ("ns3::PacketSocketFactory", Address (socket));
app.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
app.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
app.SetAttribute ("DataRate", DataRateValue (m_dataRate));
app.SetAttribute ("PacketSize", UintegerValue (m_packetSize));
ApplicationContainer apps = app.Install (nc);
apps.Start (Seconds (0.5));
Time nextEvent = Seconds (0.5);
for (uint32_t cw = m_cwMin; cw <= m_cwMax; cw += m_cwStep)
{
for (uint32_t an = 0; an < m_avgs; an++)
{
nextEvent += m_simTime;
Simulator::Schedule (nextEvent, &NetAnimExperiment::ResetData, this);
Simulator::Schedule (nextEvent, &NetAnimExperiment::UpdatePositions, this, nc);
}
Simulator::Schedule (nextEvent, &NetAnimExperiment::IncrementCw, this, cw);
}
apps.Stop (nextEvent + m_simTime);
Ptr<Node> sinkNode = sink.Get (0);
TypeId psfid = TypeId::LookupByName ("ns3::PacketSocketFactory");
if (sinkNode->GetObject<SocketFactory> (psfid) == 0)
{
Ptr<PacketSocketFactory> psf = CreateObject<PacketSocketFactory> ();
sinkNode->AggregateObject (psf);
}
Ptr<Socket> sinkSocket = Socket::CreateSocket (sinkNode, psfid);
sinkSocket->Bind (socket);
sinkSocket->SetRecvCallback (MakeCallback (&NetAnimExperiment::ReceivePacket, this));
m_bytesTotal = 0;
std::string traceFileName = "uan-animation.xml";
AnimationInterface anim(traceFileName.c_str ());
Simulator::Run ();
sinkNode = 0;
sinkSocket = 0;
pos = 0;
channel = 0;
prop = 0;
for (uint32_t i=0; i < nc.GetN (); i++)
{
nc.Get (i) = 0;
}
for (uint32_t i=0; i < sink.GetN (); i++)
{
sink.Get (i) = 0;
}
for (uint32_t i=0; i < devices.GetN (); i++)
{
devices.Get (i) = 0;
}
for (uint32_t i=0; i < sinkdev.GetN (); i++)
{
sinkdev.Get (i) = 0;
}
Simulator::Destroy ();
}
}
int
main (int argc, char **argv)
{
LogComponentEnable ("UanCwExample", LOG_LEVEL_ALL);
LogComponentEnable ("AnimationInterface", LOG_LEVEL_ALL);
NetAnimExperiment exp;
std::string perModel = "ns3::UanPhyPerGenDefault";
std::string sinrModel = "ns3::UanPhyCalcSinrDefault";
CommandLine cmd;
cmd.AddValue ("NumNodes", "Number of transmitting nodes", exp.m_numNodes);
cmd.AddValue ("Depth", "Depth of transmitting and sink nodes", exp.m_depth);
cmd.AddValue ("RegionSize", "Size of boundary in meters", exp.m_boundary);
cmd.AddValue ("PacketSize", "Generated packet size in bytes", exp.m_packetSize);
cmd.AddValue ("DataRate", "DataRate in bps", exp.m_dataRate);
cmd.AddValue ("CwMin", "Min CW to simulate", exp.m_cwMin);
cmd.AddValue ("CwMax", "Max CW to simulate", exp.m_cwMax);
cmd.AddValue ("SlotTime", "Slot time duration", exp.m_slotTime);
cmd.AddValue ("Averages", "Number of topologies to test for each cw point", exp.m_avgs);
cmd.AddValue ("PerModel", "PER model name", perModel);
cmd.AddValue ("SinrModel", "SINR model name", sinrModel);
cmd.Parse (argc, argv);
ObjectFactory obf;
obf.SetTypeId (perModel);
Ptr<UanPhyPer> per = obf.Create<UanPhyPer> ();
obf.SetTypeId (sinrModel);
Ptr<UanPhyCalcSinr> sinr = obf.Create<UanPhyCalcSinr> ();
UanHelper uan;
UanTxMode mode;
mode = UanTxModeFactory::CreateMode (UanTxMode::FSK, exp.m_dataRate,
exp.m_dataRate, 12000,
exp.m_dataRate, 2,
"Default mode");
UanModesList myModes;
myModes.AppendMode (mode);
uan.SetPhy ("ns3::UanPhyGen",
"PerModel", PointerValue (per),
"SinrModel", PointerValue (sinr),
"SupportedModes", UanModesListValue (myModes));
exp.Run (uan);
per = 0;
sinr = 0;
}
-62
View File
@@ -1,62 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 Andrea Sacco
*
* 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: Andrea Sacco <andrea.sacco85@gmail.com>
*/
#ifndef UAN_CW_EXAMPLE_H
#define UAN_CW_EXAMPLE_H
#include "ns3/network-module.h"
#include "ns3/tools-module.h"
#include "ns3/uan-module.h"
using namespace ns3;
/**
* \class NetAnimExperiment
* \brief Helper class for UAN CW MAC example
*
*/
class NetAnimExperiment
{
public:
void Run (UanHelper &uan);
void ReceivePacket (Ptr<Socket> socket);
void UpdatePositions (NodeContainer &nodes);
void ResetData ();
void IncrementCw (uint32_t cw);
uint32_t m_numNodes;
uint32_t m_dataRate;
double m_depth;
double m_boundary;
uint32_t m_packetSize;
uint32_t m_bytesTotal;
uint32_t m_cwMin;
uint32_t m_cwMax;
uint32_t m_cwStep;
uint32_t m_avgs;
Time m_slotTime;
Time m_simTime;
std::vector<double> m_throughputs;
NetAnimExperiment ();
};
#endif /* UAN_CW_EXAMPLE_H */
-4
View File
@@ -16,7 +16,3 @@ def build(bld):
obj = bld.create_ns3_program('wireless-animation',
['netanim', 'applications', 'point-to-point', 'csma', 'wifi', 'mobility', 'network'])
obj.source = 'wireless-animation.cc'
obj = bld.create_ns3_program('uan-animation',
['netanim', 'internet', 'mobility', 'tools', 'applications', 'uan'])
obj.source = 'uan-animation.cc'
+5 -61
View File
@@ -37,8 +37,6 @@
#include "ns3/constant-position-mobility-model.h"
#include "ns3/lte-ue-phy.h"
#include "ns3/lte-enb-phy.h"
#include "ns3/uan-net-device.h"
#include "ns3/uan-mac.h"
#include <stdio.h>
#include <unistd.h>
@@ -50,6 +48,8 @@
NS_LOG_COMPONENT_DEFINE ("AnimationInterface");
namespace ns3 {
#define PURGE_INTERVAL 5
@@ -161,11 +161,6 @@ bool AnimationInterface::IsInTimeWindow ()
return false;
}
bool AnimationInterface::UanPacketIsPending (uint64_t AnimUid)
{
return (m_pendingUanPackets.find (AnimUid) != m_pendingUanPackets.end ());
}
bool AnimationInterface::WifiPacketIsPending (uint64_t AnimUid)
{
return (m_pendingWifiPackets.find (AnimUid) != m_pendingWifiPackets.end ());
@@ -552,10 +547,6 @@ void AnimationInterface::ConnectCallbacks ()
MakeCallback (&AnimationInterface::CsmaPhyRxEndTrace, this));
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacRx",
MakeCallback (&AnimationInterface::CsmaMacRxTrace, this));
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyTxBegin",
MakeCallback (&AnimationInterface::UanPhyGenTxTrace, this));
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::UanNetDevice/Phy/PhyRxBegin",
MakeCallback (&AnimationInterface::UanPhyGenRxTrace, this));
ConnectLte ();
@@ -694,7 +685,7 @@ void AnimationInterface::DevTxTrace (std::string context,
Ptr<NetDevice> tx, Ptr<NetDevice> rx,
Time txTime, Time rxTime)
{
if (!m_started || !IsInTimeWindow ())
if (!m_started)
return;
NS_ASSERT (tx);
NS_ASSERT (rx);
@@ -740,12 +731,6 @@ AnimationInterface::GetNetDeviceFromContext (std::string context)
NS_ASSERT (n);
return n->GetDevice (atoi (elements[3].c_str ()));
}
void AnimationInterface::AddPendingUanPacket (uint64_t AnimUid, AnimPacketInfo &pktinfo)
{
m_pendingUanPackets[AnimUid] = pktinfo;
}
void AnimationInterface::AddPendingWifiPacket (uint64_t AnimUid, AnimPacketInfo &pktinfo)
{
@@ -795,47 +780,6 @@ uint64_t AnimationInterface::GetAnimUidFromPacket (Ptr <const Packet> p)
}
}
void AnimationInterface::UanPhyGenTxTrace (std::string context, Ptr<const Packet> p)
{
if (!m_started || !IsInTimeWindow ())
return;
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context);
NS_ASSERT (ndev);
Ptr <Node> n = ndev->GetNode ();
NS_ASSERT (n);
gAnimUid++;
NS_LOG_INFO ("Uan TxBeginTrace for packet:" << gAnimUid);
AnimByteTag tag;
tag.Set (gAnimUid);
p->AddByteTag (tag);
AnimPacketInfo pktinfo (ndev, Simulator::Now (), Simulator::Now (), UpdatePosition (n));
AddPendingUanPacket (gAnimUid, pktinfo);
}
void AnimationInterface::UanPhyGenRxTrace (std::string context, Ptr<const Packet> p)
{
if (!m_started || !IsInTimeWindow ())
return;
Ptr <NetDevice> ndev = GetNetDeviceFromContext (context);
NS_ASSERT (ndev);
Ptr <Node> n = ndev->GetNode ();
NS_ASSERT (n);
uint64_t AnimUid = GetAnimUidFromPacket (p);
NS_LOG_INFO ("UanPhyGenRxTrace for packet:" << AnimUid);
if (!UanPacketIsPending (AnimUid))
{
NS_LOG_WARN ("UanPhyGenRxBeginTrace: unknown Uid");
return;
}
m_pendingUanPackets[AnimUid].ProcessRxBegin (ndev, Simulator::Now ());
m_pendingUanPackets[AnimUid].ProcessRxEnd (ndev, Simulator::Now (), UpdatePosition (n));
OutputWirelessPacket (p, m_pendingUanPackets[AnimUid], m_pendingUanPackets[AnimUid].GetRxInfo (ndev));
}
void AnimationInterface::WifiPhyTxBeginTrace (std::string context,
Ptr<const Packet> p)
{
@@ -847,7 +791,7 @@ void AnimationInterface::WifiPhyTxBeginTrace (std::string context,
NS_ASSERT (n);
// Add a new pending wireless
gAnimUid++;
NS_LOG_INFO ("Wifi TxBeginTrace for packet:" << gAnimUid);
NS_LOG_INFO ("TxBeginTrace for packet:" << gAnimUid);
AnimByteTag tag;
tag.Set (gAnimUid);
p->AddByteTag (tag);
@@ -891,7 +835,7 @@ void AnimationInterface::WifiPhyRxBeginTrace (std::string context,
Ptr <Node> n = ndev->GetNode ();
NS_ASSERT (n);
uint64_t AnimUid = GetAnimUidFromPacket (p);
NS_LOG_INFO ("Wifi RxBeginTrace for packet:" << AnimUid);
NS_LOG_INFO ("RxBeginTrace for packet:" << AnimUid);
if (!WifiPacketIsPending (AnimUid))
{
NS_LOG_WARN ("WifiPhyRxBeginTrace: unknown Uid");
-10
View File
@@ -36,7 +36,6 @@
#include "ns3/mac48-address.h"
#include "ns3/lte-ue-net-device.h"
#include "ns3/lte-enb-net-device.h"
#include "ns3/uan-phy-gen.h"
namespace ns3 {
@@ -313,11 +312,6 @@ private:
void LteSpectrumPhyRxStart (std::string context,
Ptr<const PacketBurst> pb);
void UanPhyGenTxTrace (std::string context,
Ptr<const Packet>);
void UanPhyGenRxTrace (std::string context,
Ptr<const Packet>);
void MobilityCourseChangeTrace (Ptr <const MobilityModel> mob);
// Write a string to the specified handle;
@@ -344,10 +338,6 @@ private:
void AddPendingCsmaPacket (uint64_t AnimUid, AnimPacketInfo&);
bool CsmaPacketIsPending (uint64_t AnimUid);
std::map<uint64_t, AnimPacketInfo> m_pendingUanPackets;
void AddPendingUanPacket (uint64_t AnimUid, AnimPacketInfo&);
bool UanPacketIsPending (uint64_t AnimUid);
uint64_t GetAnimUidFromPacket (Ptr <const Packet>);
std::map<uint32_t, Vector> m_nodeLocation;
+6 -1
View File
@@ -8,7 +8,7 @@ NETANIM_RELEASE_NAME = "netanim-3.100"
def build (bld) :
bld.install_files('${INCLUDEDIR}/%s%s/ns3' % (wutils.APPNAME, wutils.VERSION), '../../ns3/netanim-config.h')
module = bld.create_ns3_module ('netanim', ['internet', 'mobility', 'wimax', 'wifi', 'csma', 'lte', 'uan'])
module = bld.create_ns3_module ('netanim', ['internet', 'mobility', 'wimax', 'wifi', 'csma', 'lte'])
module.includes = '.'
module.source = [
'model/animation-interface.cc',
@@ -29,3 +29,8 @@ def build (bld) :
if (bld.env['ENABLE_EXAMPLES']) :
bld.add_subdirs ('examples')
def configure (conf) :
conf.check (header_name='sys/socket.h', define_name='HAVE_SYS_SOCKET_H')
conf.check (header_name='netinet/in.h', define_name='HAVE_NETINET_IN_H')
conf.write_config_header ('ns3/netanim-config.h', top=True)
-165
View File
@@ -1,165 +0,0 @@
Queues
------
.. heading hierarchy:
------------- Chapter
************* Section (#.#)
============= Subsection (#.#.#)
############# Paragraph (no number)
This section documents a few queue objects, typically associated with
NetDevice models, that are maintained as part of the ``network`` module:
* DropTail
* Random Early Detection
Model Description
*****************
The source code for the new module lives in the directory ``src/network/utils``.
ns-3 provides a couple of classic queue models and the ability to
trace certain queue operations such as enqueuing, dequeuing, and dropping.
These may be added to certain NetDevice objects that take a Ptr<Queue>
pointer.
Note that not all device models use these queue models.
In particular, WiFi, WiMax, and LTE use specialized device queues.
The queue models described here are more often used with simpler ns-3
device models such as PointToPoint and Csma.
Design
======
An abstract base class, class Queue, is typically used and subclassed
for specific scheduling and drop policies. Common operations
include:
* ``bool Enqueue (Ptr<Packet> p)``: Enqueue a packet
* ``Ptr<Packet> Dequeue (void)``: Dequeue a packet
* ``uint32_t GetNPackets (void)``: Get the queue depth, in packets
* ``uint32_t GetNBytes (void)``: Get the queue depth, in packets
as well as tracking some statistics on queue operations.
There are three trace sources that may be hooked:
* ``Enqueue``
* ``Dequeue``
* ``Drop``
DropTail
########
This is a basic first-in-first-out (FIFO) queue that performs a tail drop
when the queue is full.
Random Early Detection
######################
Random Early Detection (RED) is a queue variant that aims to provide
early signals to transport protocol congestion control (e.g. TCP) that
congestion is imminent, so that they back off their rate gracefully
rather than with a bunch of tail-drop losses (possibly incurring
TCP timeout). The model in ns-3 is a port of Sally Floyd's ns-2
RED model.
Scope and Limitations
=====================
The RED model just supports default RED. Adaptive RED is not supported.
References
==========
The RED queue aims to be close to the results cited in:
S.Floyd, K.Fall http://icir.org/floyd/papers/redsims.ps
Usage
*****
Helpers
=======
A typical usage pattern is to create a device helper and to configure
the queue type and attributes from the helper, such as this example
from ``src/network/examples/red-tests.cc``:
::
PointToPointHelper p2p;
p2p.SetQueue ("ns3::DropTailQueue");
p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer devn0n2 = p2p.Install (n0n2);
p2p.SetQueue ("ns3::DropTailQueue");
p2p.SetDeviceAttribute ("DataRate", StringValue ("10Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("3ms"));
NetDeviceContainer devn1n2 = p2p.Install (n1n2);
p2p.SetQueue ("ns3::RedQueue", // only backbone link has RED queue
"LinkBandwidth", StringValue (redLinkDataRate),
"LinkDelay", StringValue (redLinkDelay));
p2p.SetDeviceAttribute ("DataRate", StringValue (redLinkDataRate));
p2p.SetChannelAttribute ("Delay", StringValue (redLinkDelay));
NetDeviceContainer devn2n3 = p2p.Install (n2n3);
Attributes
==========
The RED queue contains a number of attributes that control the RED
policies:
* Mode (bytes or packets)
* MeanPktSize
* IdlePktSize
* Wait (time)
* Gentle mode
* MinTh, MaxTh
* QueueLimit
* Queue weight
* LInterm
* LinkBandwidth
* LinkDelay
Consult the ns-3 documentation for explanation of these attributes.
Output
======
The ns-3 ascii trace helpers used by many of the NetDevices will hook
the Enqueue, Dequeue, and Drop traces of these queues and print out
trace statements, such as the following from ``examples/udp/udp-echo.cc``:
::
+ 2 /NodeList/0/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Enqueue ns3::EthernetHeader
( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1
dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
- 2 /NodeList/0/DeviceList/1/$ns3::CsmaNetDevice/TxQueue/Dequeue ns3::EthernetHeader
( length/type=0x806, source=00:00:00:00:00:01, destination=ff:ff:ff:ff:ff:ff)
ns3::ArpHeader (request source mac: 00-06-00:00:00:00:00:01 source ipv4: 10.1.1.1
dest ipv4: 10.1.1.2) Payload (size=18) ns3::EthernetTrailer (fcs=0)
which shows an enqueue "+" and dequeue "-" event at time 2 seconds.
Users are, of course, free to define and hook their own trace sinks to
these trace sources.
Examples
========
The drop-tail queue is used in several examples, such as
``examples/udp/udp-echo.cc``. The RED queue example is found at
``src/network/examples/red-tests.cc``.
Validation
**********
The RED model has been validated and the report is currently stored
at: https://github.com/downloads/talau/ns-3-tcp-red/report-red-ns3.pdf
+4 -5
View File
@@ -96,8 +96,8 @@ MyTag::GetSimpleValue (void) const
int main (int argc, char *argv[])
{
// create a tag.
MyTag tag;
tag.SetSimpleValue (0x56);
Ptr<MyTag> tag = CreateObject<MyTag> ();
tag->SetSimpleValue (0x56);
// store the tag in a packet.
Ptr<Packet> p = Create<Packet> (100);
@@ -107,11 +107,10 @@ int main (int argc, char *argv[])
Ptr<Packet> aCopy = p->Copy ();
// read the tag from the packet copy
MyTag tagCopy;
p->PeekPacketTag (tagCopy);
Ptr<const MyTag> tagCopy = p->PeekPacketTag<MyTag> ();
// the copy and the original are the same !
NS_ASSERT (tagCopy.GetSimpleValue () == tag.GetSimpleValue ());
NS_ASSERT (tagCopy->GetSimpleValue () == tag->GetSimpleValue ());
aCopy->PrintPacketTags (std::cout);
std::cout << std::endl;
+1 -1
View File
@@ -59,7 +59,7 @@ class Packet;
*
* If you want to write a new MAC layer, you need to subclass
* this base class and implement your own version of the
* pure virtual methods in this class.
* NetDevice::SendTo method.
*
* This class was designed to hide as many MAC-level details as
* possible from the perspective of layer 3 to allow a single layer 3
+122 -126
View File
@@ -28,150 +28,146 @@ NS_LOG_COMPONENT_DEFINE ("PacketTagList");
namespace ns3 {
#ifdef USE_FREE_LIST
struct PacketTagList::TagData *PacketTagList::g_free = 0;
uint32_t PacketTagList::g_nfree = 0;
struct PacketTagList::TagData *
PacketTagList::AllocData (void) const
{
NS_LOG_FUNCTION (g_nfree);
struct PacketTagList::TagData *retval;
if (g_free != 0)
{
retval = g_free;
g_free = g_free->m_next;
g_nfree--;
}
else
{
retval = new struct PacketTagList::TagData ();
}
return retval;
}
void
PacketTagList::FreeData (struct TagData *data) const
PacketTagList::Add (Ptr<const Tag> tag)
{
NS_LOG_FUNCTION (g_nfree << data);
if (g_nfree > 1000)
{
delete data;
return;
}
g_nfree++;
data->next = g_free;
data->tid = TypeId ();
g_free = data;
}
#else
struct PacketTagList::TagData *
PacketTagList::AllocData (void) const
{
NS_LOG_FUNCTION_NOARGS ();
struct PacketTagList::TagData *retval;
retval = new struct PacketTagList::TagData ();
return retval;
NS_LOG_FUNCTION (this << tag->GetInstanceTypeId ());
NS_ASSERT_MSG (Peek (tag->GetInstanceTypeId ()) == 0,
"Only one tag type per packet is allowed");
push_back (tag);
}
void
PacketTagList::FreeData (struct TagData *data) const
Ptr<const Tag>
PacketTagList::Remove (TypeId tagType)
{
NS_LOG_FUNCTION (data);
delete data;
}
#endif
bool
PacketTagList::Remove (Tag &tag)
{
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
TypeId tid = tag.GetInstanceTypeId ();
bool found = false;
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
NS_LOG_FUNCTION (this << tagType);
for (iterator tag = begin (); tag != end (); tag++)
{
if (cur->tid == tid)
if ((*tag)->GetInstanceTypeId () == tagType)
{
found = true;
tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
Ptr<const Tag> retval = *tag;
erase (tag);
return retval;
}
}
if (!found)
{
return false;
}
struct TagData *start = 0;
struct TagData **prevNext = &start;
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
{
if (cur->tid == tid)
{
/**
* XXX
* Note: I believe that we could optimize this to
* avoid copying each TagData located after the target id
* and just link the already-copied list to the next tag.
*/
continue;
}
struct TagData *copy = AllocData ();
copy->tid = cur->tid;
copy->count = 1;
copy->next = 0;
memcpy (copy->data, cur->data, PACKET_TAG_MAX_SIZE);
*prevNext = copy;
prevNext = &copy->next;
}
*prevNext = 0;
RemoveAll ();
m_next = start;
return true;
return 0;
}
void
PacketTagList::Add (const Tag &tag) const
Ptr<const Tag>
PacketTagList::Peek (TypeId tagType) const
{
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
// ensure this id was not yet added
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
NS_LOG_FUNCTION (this << tagType);
for (const_iterator tag = begin (); tag != end (); tag++)
{
NS_ASSERT (cur->tid != tag.GetInstanceTypeId ());
if ((*tag)->GetInstanceTypeId () == tagType)
return *tag;
}
struct TagData *head = AllocData ();
head->count = 1;
head->next = 0;
head->tid = tag.GetInstanceTypeId ();
head->next = m_next;
NS_ASSERT (tag.GetSerializedSize () <= PACKET_TAG_MAX_SIZE);
tag.Serialize (TagBuffer (head->data, head->data+tag.GetSerializedSize ()));
const_cast<PacketTagList *> (this)->m_next = head;
return 0;
}
bool
PacketTagList::Peek (Tag &tag) const
{
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
TypeId tid = tag.GetInstanceTypeId ();
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
{
if (cur->tid == tid)
{
/* found tag */
tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
return true;
}
}
/* no tag found */
return false;
}
const struct PacketTagList::TagData *
PacketTagList::Head (void) const
{
return m_next;
}
// bool
// PacketTagList::Remove (Tag &tag)
// {
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
// return false;
// // TypeId tid = tag.GetInstanceTypeId ();
// // bool found = false;
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
// // {
// // if (cur->tid == tid)
// // {
// // found = true;
// // tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
// // }
// // }
// // if (!found)
// // {
// // return false;
// // }
// // struct TagData *start = 0;
// // struct TagData **prevNext = &start;
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
// // {
// // if (cur->tid == tid)
// // {
// // /**
// // * XXX
// // * Note: I believe that we could optimize this to
// // * avoid copying each TagData located after the target id
// // * and just link the already-copied list to the next tag.
// // */
// // continue;
// // }
// // struct TagData *copy = AllocData ();
// // copy->tid = cur->tid;
// // copy->count = 1;
// // copy->next = 0;
// // memcpy (copy->data, cur->data, PACKET_TAG_MAX_SIZE);
// // *prevNext = copy;
// // prevNext = &copy->next;
// // }
// // *prevNext = 0;
// // RemoveAll ();
// // m_next = start;
// // return true;
// }
// void
// PacketTagList::Add (const Tag &tag) const
// {
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
// // ensure this id was not yet added
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
// // {
// // NS_ASSERT (cur->tid != tag.GetInstanceTypeId ());
// // }
// // struct TagData *head = AllocData ();
// // head->count = 1;
// // head->next = 0;
// // head->tid = tag.GetInstanceTypeId ();
// // head->next = m_next;
// // NS_ASSERT (tag.GetSerializedSize () <= PACKET_TAG_MAX_SIZE);
// // tag.Serialize (TagBuffer (head->data, head->data+tag.GetSerializedSize ()));
// // const_cast<PacketTagList *> (this)->m_next = head;
// // m_tags.
// }
// bool
// PacketTagList::Peek (Tag &tag) const
// {
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ());
// // TypeId tid = tag.GetInstanceTypeId ();
// // for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
// // {
// // if (cur->tid == tid)
// // {
// // /* found tag */
// // tag.Deserialize (TagBuffer (cur->data, cur->data+PACKET_TAG_MAX_SIZE));
// // return true;
// // }
// // }
// /* no tag found */
// return false;
// }
// // const struct PacketTagList::TagData *
// // PacketTagList::Head (void) const
// // {
// // return m_next;
// // }
} // namespace ns3
+46 -83
View File
@@ -21,7 +21,7 @@
#define PACKET_TAG_LIST_H
#include <stdint.h>
#include <ostream>
#include <list>
#include "ns3/type-id.h"
namespace ns3 {
@@ -34,40 +34,30 @@ class Tag;
* The maximum size (in bytes) of a Tag is stored
* in this constant.
*/
#define PACKET_TAG_MAX_SIZE 20
// #define PACKET_TAG_MAX_SIZE 20
class PacketTagList
class PacketTagList : public std::list<Ptr<const Tag> >
{
public:
struct TagData {
uint8_t data[PACKET_TAG_MAX_SIZE];
struct TagData *next;
TypeId tid;
uint32_t count;
};
// struct TagData {
// std::vector<uint8_t> data;
// TypeId tid;
// uint32_t count;
// };
inline PacketTagList ();
inline PacketTagList (PacketTagList const &o);
inline PacketTagList &operator = (PacketTagList const &o);
inline ~PacketTagList ();
// inline PacketTagList ();
// inline PacketTagList (PacketTagList const &o);
// inline PacketTagList &operator = (PacketTagList const &o);
// inline ~PacketTagList ();
void Add (Tag const&tag) const;
bool Remove (Tag &tag);
bool Peek (Tag &tag) const;
inline void RemoveAll (void);
void
Add (Ptr<const Tag> tag);
const struct PacketTagList::TagData *Head (void) const;
Ptr<const Tag>
Remove (TypeId tagType);
private:
bool Remove (TypeId tid);
struct PacketTagList::TagData *AllocData (void) const;
void FreeData (struct TagData *data) const;
static struct PacketTagList::TagData *g_free;
static uint32_t g_nfree;
struct TagData *m_next;
Ptr<const Tag>
Peek (TypeId tagType) const;
};
} // namespace ns3
@@ -78,65 +68,38 @@ private:
namespace ns3 {
PacketTagList::PacketTagList ()
: m_next ()
{
}
// PacketTagList::PacketTagList ()
// {
// }
PacketTagList::PacketTagList (PacketTagList const &o)
: m_next (o.m_next)
{
if (m_next != 0)
{
m_next->count++;
}
}
// PacketTagList::PacketTagList (PacketTagList const &o)
// : m_tags (o.m_tags)
// {
// }
PacketTagList &
PacketTagList::operator = (PacketTagList const &o)
{
// self assignment
if (m_next == o.m_next)
{
return *this;
}
RemoveAll ();
m_next = o.m_next;
if (m_next != 0)
{
m_next->count++;
}
return *this;
}
// PacketTagList &
// PacketTagList::operator = (PacketTagList const &o)
// {
// // self assignment
// if (&o == this)
// {
// return *this;
// }
// // RemoveAll (); // ???
// m_tags = o.m_tags;
// return *this;
// }
PacketTagList::~PacketTagList ()
{
RemoveAll ();
}
// PacketTagList::~PacketTagList ()
// {
// RemoveAll ();
// }
void
PacketTagList::RemoveAll (void)
{
struct TagData *prev = 0;
for (struct TagData *cur = m_next; cur != 0; cur = cur->next)
{
cur->count--;
if (cur->count > 0)
{
break;
}
if (prev != 0)
{
FreeData (prev);
}
prev = cur;
}
if (prev != 0)
{
FreeData (prev);
}
m_next = 0;
}
// void
// PacketTagList::RemoveAll (void)
// {
// m_tags.clear ();
// }
} // namespace ns3
+93 -63
View File
@@ -81,39 +81,39 @@ ByteTagIterator::ByteTagIterator (ByteTagList::Iterator i)
}
PacketTagIterator::PacketTagIterator (const struct PacketTagList::TagData *head)
: m_current (head)
{
}
bool
PacketTagIterator::HasNext (void) const
{
return m_current != 0;
}
PacketTagIterator::Item
PacketTagIterator::Next (void)
{
NS_ASSERT (HasNext ());
const struct PacketTagList::TagData *prev = m_current;
m_current = m_current->next;
return PacketTagIterator::Item (prev);
}
// PacketTagIterator::PacketTagIterator (const struct PacketTagList::TagData *head)
// : m_current (head)
// {
// }
// bool
// PacketTagIterator::HasNext (void) const
// {
// return m_current != 0;
// }
// PacketTagIterator::Item
// PacketTagIterator::Next (void)
// {
// NS_ASSERT (HasNext ());
// const struct PacketTagList::TagData *prev = m_current;
// m_current = m_current->next;
// return PacketTagIterator::Item (prev);
// }
PacketTagIterator::Item::Item (const struct PacketTagList::TagData *data)
: m_data (data)
{
}
TypeId
PacketTagIterator::Item::GetTypeId (void) const
{
return m_data->tid;
}
void
PacketTagIterator::Item::GetTag (Tag &tag) const
{
NS_ASSERT (tag.GetInstanceTypeId () == m_data->tid);
tag.Deserialize (TagBuffer ((uint8_t*)m_data->data, (uint8_t*)m_data->data+PACKET_TAG_MAX_SIZE));
}
// PacketTagIterator::Item::Item (const struct PacketTagList::TagData *data)
// : m_data (data)
// {
// }
// TypeId
// PacketTagIterator::Item::GetTypeId (void) const
// {
// return m_data->tid;
// }
// void
// PacketTagIterator::Item::GetTag (Tag &tag) const
// {
// NS_ASSERT (tag.GetInstanceTypeId () == m_data->tid);
// tag.Deserialize (TagBuffer ((uint8_t*)m_data->data, (uint8_t*)m_data->data+PACKET_TAG_MAX_SIZE));
// }
Ptr<Packet>
@@ -835,60 +835,90 @@ Packet::FindFirstMatchingByteTag (Tag &tag) const
return false;
}
void
Packet::AddPacketTag (const Tag &tag) const
// void
// Packet::AddPacketTag (const Tag &tag) const
// {
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
// m_packetTagList.Add (tag);
// }
// bool
// Packet::RemovePacketTag (Tag &tag)
// {
// NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
// bool found = m_packetTagList.Remove (tag);
// return found;
// }
// bool
// Packet::PeekPacketTag (Tag &tag) const
// {
// bool found = m_packetTagList.Peek (tag);
// return found;
// }
void
Packet::AddPacketTag (Ptr<const Tag> tag)
{
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
m_packetTagList.Add (tag);
}
bool
Packet::RemovePacketTag (Tag &tag)
Ptr<const Tag>
Packet::RemovePacketTag (TypeId tagType)
{
NS_LOG_FUNCTION (this << tag.GetInstanceTypeId ().GetName () << tag.GetSerializedSize ());
bool found = m_packetTagList.Remove (tag);
return found;
return m_packetTagList.Remove (tagType);
}
bool
Packet::PeekPacketTag (Tag &tag) const
Ptr<const Tag>
Packet::PeekPacketTag (TypeId tagType) const
{
bool found = m_packetTagList.Peek (tag);
return found;
return m_packetTagList.Peek (tagType);
}
void
Packet::RemoveAllPacketTags (void)
{
NS_LOG_FUNCTION (this);
m_packetTagList.RemoveAll ();
m_packetTagList.clear ();
}
void
Packet::PrintPacketTags (std::ostream &os) const
{
PacketTagIterator i = GetPacketTagIterator ();
while (i.HasNext ())
for (PacketTagList::const_iterator tag = m_packetTagList.begin ();
tag != m_packetTagList.end ();
tag++)
{
PacketTagIterator::Item item = i.Next ();
NS_ASSERT (item.GetTypeId ().HasConstructor ());
Callback<ObjectBase *> constructor = item.GetTypeId ().GetConstructor ();
NS_ASSERT (!constructor.IsNull ());
ObjectBase *instance = constructor ();
Tag *tag = dynamic_cast<Tag *> (instance);
NS_ASSERT (tag != 0);
item.GetTag (*tag);
tag->Print (os);
delete tag;
if (i.HasNext ())
if (tag != m_packetTagList.begin ())
{
os << " ";
}
(*tag)->Print (os);
}
// PacketTagIterator i = GetPacketTagIterator ();
// while (i.HasNext ())
// {
// PacketTagIterator::Item item = i.Next ();
// NS_ASSERT (item.GetTypeId ().HasConstructor ());
// Callback<ObjectBase *> constructor = item.GetTypeId ().GetConstructor ();
// NS_ASSERT (!constructor.IsNull ());
// ObjectBase *instance = constructor ();
// Tag *tag = dynamic_cast<Tag *> (instance);
// NS_ASSERT (tag != 0);
// item.GetTag (*tag);
// tag->Print (os);
// delete tag;
// if (i.HasNext ())
// {
// os << " ";
// }
// }
}
PacketTagIterator
Packet::GetPacketTagIterator (void) const
{
return PacketTagIterator (m_packetTagList.Head ());
}
// PacketTagIterator
// Packet::GetPacketTagIterator (void) const
// {
// return PacketTagIterator (m_packetTagList.Head ());
// }
std::ostream& operator<< (std::ostream& os, const Packet &packet)
{
+47 -62
View File
@@ -104,53 +104,6 @@ private:
ByteTagList::Iterator m_current;
};
/**
* \ingroup packet
* \brief Iterator over the set of 'packet' tags in a packet
*
* This is a java-style iterator.
*/
class PacketTagIterator
{
public:
/**
* Identifies a tag within a packet.
*/
class Item
{
public:
/**
* \returns the ns3::TypeId associated to this tag.
*/
TypeId GetTypeId (void) const;
/**
* \param tag the user tag to which the data should be copied.
*
* Read the requested tag and store it in the user-provided
* tag instance. This method will crash if the type of the
* tag provided by the user does not match the type of
* the underlying tag.
*/
void GetTag (Tag &tag) const;
private:
friend class PacketTagIterator;
Item (const struct PacketTagList::TagData *data);
const struct PacketTagList::TagData *m_data;
};
/**
* \returns true if calling Next is safe, false otherwise.
*/
bool HasNext (void) const;
/**
* \returns the next item found and prepare for the next one.
*/
Item Next (void);
private:
friend class Packet;
PacketTagIterator (const struct PacketTagList::TagData *head);
const struct PacketTagList::TagData *m_current;
};
/**
* \ingroup packet
* \brief network packets
@@ -498,31 +451,63 @@ public:
/**
* \param tag the tag to store in this packet
*
* Add a tag to this packet. This method calls the
* Tag::GetSerializedSize and, then, Tag::Serialize.
*
* Note that this method is const, that is, it does not
* modify the state of this packet, which is fairly
* un-intuitive.
* Add a tag to this packet.
*/
void AddPacketTag (const Tag &tag) const;
void
AddPacketTag (Ptr<const Tag> tag);
/**
* \param tag the tag to remove from this packet
* \returns true if the requested tag is found, false
* otherwise.
* \returns smart pointer to a constant Tag object if the requested tag is found,
* 0 otherwise.
*
* Remove a tag from this packet. This method calls
* Tag::Deserialize if the tag is found.
* Remove a tag from this packet.
*/
bool RemovePacketTag (Tag &tag);
Ptr<const Tag>
RemovePacketTag (TypeId tagType);
/**
* \param tag the tag to remove from this packet
* \returns smart pointer to a constant Tag object if the requested tag is found,
* 0 otherwise.
*
* Templated version to remove a tag from this packet.
* In addition to non-templated version, there is a DynamicCast to
* the requested tag type
*/
template<class T>
Ptr<const T>
RemovePacketTag ()
{
return DynamicCast<const T> (RemovePacketTag (T::GetTypeId ()));
}
/**
* \param tag the tag to search in this packet
* \returns true if the requested tag is found, false
* otherwise.
*
* Search a matching tag and call Tag::Deserialize if it is found.
* Search a matching tag and return it if found
*/
bool PeekPacketTag (Tag &tag) const;
Ptr<const Tag>
PeekPacketTag (TypeId tagType) const;
/**
* \param tag the tag to search in this packet
* \returns true if the requested tag is found, false
* otherwise.
*
* Templated version of search for a matching tag and returning it if found
* In addition to non-templated version, there is a DynamicCast to
* the requested tag type
*/
template<class T>
Ptr<const T>
PeekPacketTag () const
{
return DynamicCast<const T> (PeekPacketTag (T::GetTypeId ()));
}
/**
* Remove all packet tags.
*/
@@ -542,7 +527,7 @@ public:
* \returns an object which can be used to iterate over the list of
* packet tags.
*/
PacketTagIterator GetPacketTagIterator (void) const;
// PacketTagIterator GetPacketTagIterator (void) const;
/* Note: These functions support a temporary solution
* to a specific problem in this generic class, i.e.
+9 -2
View File
@@ -20,7 +20,7 @@
#ifndef TAG_H
#define TAG_H
#include "ns3/object-base.h"
#include "ns3/object.h"
#include "tag-buffer.h"
#include <stdint.h>
@@ -33,7 +33,7 @@ namespace ns3 {
*
* New kinds of tags can be created by subclassing this base class.
*/
class Tag : public ObjectBase
class Tag : public Object
{
public:
static TypeId GetTypeId (void);
@@ -71,6 +71,13 @@ public:
virtual void Print (std::ostream &os) const = 0;
};
inline std::ostream &
operator << (std::ostream &os, const Tag &tag)
{
tag.Print (os);
return os;
}
} // namespace ns3
#endif /* TAG_H */
+22 -22
View File
@@ -391,33 +391,33 @@ PacketTest::DoRun (void)
{
Packet p;
ATestTag<10> a;
Ptr< ATestTag<10> > a = CreateObject< ATestTag<10> > ();
p.AddPacketTag (a);
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (a), true, "trivial");
ATestTag<11> b;
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
Ptr< ATestTag<11> > b = CreateObject< ATestTag<11> > ();
p.AddPacketTag (b);
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (b), true, "trivial");
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (a), true, "trivial");
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
Packet copy = p;
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (b), true, "trivial");
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (a), true, "trivial");
ATestTag<12> c;
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (c), false, "trivial");
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
Ptr< ATestTag<12> > c = CreateObject< ATestTag<12> > ();
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
copy.AddPacketTag (c);
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (c), true, "trivial");
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (b), true, "trivial");
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (a), true, "trivial");
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (c), false, "trivial");
copy.RemovePacketTag (b);
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (b), false, "trivial");
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (b), true, "trivial");
p.RemovePacketTag (a);
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (a), false, "trivial");
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (a), true, "trivial");
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (c), false, "trivial");
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag (c), true, "trivial");
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
copy.RemovePacketTag< ATestTag<11> > ();
NS_TEST_EXPECT_MSG_EQ (copy.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_NE (p.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
p.RemovePacketTag< ATestTag<10> > ();
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<10> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
NS_TEST_EXPECT_MSG_NE (copy.PeekPacketTag< ATestTag<12> > (), 0, "trivial");
p.RemoveAllPacketTags ();
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag (b), false, "trivial");
NS_TEST_EXPECT_MSG_EQ (p.PeekPacketTag< ATestTag<11> > (), 0, "trivial");
}
{
+5 -5
View File
@@ -130,10 +130,10 @@ Ipv4Mask::GetInverse (void) const
void
Ipv4Mask::Print (std::ostream &os) const
{
os << ((m_mask >> 24) & 0xff) << "."
<< ((m_mask >> 16) & 0xff) << "."
<< ((m_mask >> 8) & 0xff) << "."
<< ((m_mask >> 0) & 0xff);
os << (int)((m_mask >> 24) & 0xff) << "."
<< (int)((m_mask >> 16) & 0xff) << "."
<< (int)((m_mask >> 8) & 0xff) << "."
<< (int)((m_mask >> 0) & 0xff);
}
@@ -183,7 +183,7 @@ Ipv4Address::Ipv4Address (char const *address)
m_address = AsciiToIpv4Host (address);
}
uint32_t
const uint32_t &
Ipv4Address::Get (void) const
{
return m_address;
+2 -1
View File
@@ -57,7 +57,8 @@ public:
* Get the host-order 32-bit IP address
* \return the host-order 32-bit IP address
*/
uint32_t Get (void) const;
const uint32_t &
Get (void) const;
/**
* input address is in host order.
* \param address The host order 32-bit address
+5 -7
View File
@@ -386,8 +386,8 @@ PacketSocket::ForwardUp (Ptr<NetDevice> device, Ptr<const Packet> packet,
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
{
Ptr<Packet> copy = packet->Copy ();
SocketAddressTag tag;
tag.SetAddress (address);
Ptr<SocketAddressTag> tag = Create<SocketAddressTag> ();
tag->SetAddress (address);
copy->AddPacketTag (tag);
m_deliveryQueue.push (copy);
m_rxAvailable += packet->GetSize ();
@@ -443,11 +443,9 @@ PacketSocket::RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress)
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;
}
+20
View File
@@ -0,0 +1,20 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*
* 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
+267
View File
@@ -0,0 +1,267 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011 University of California, Los Angeles
*
* 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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef _TRIE_H_
#define _TRIE_H_
#ifndef __GNUC__
#error "gcc is required to compile this code"
#else
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#if __GNUC__ < 4 || (__GNUC__==4 && __GNUC_MINOR__<=1)
#error "gcc version at least 4.1 is required to compile this code"
#elif (__GNUC__==4 && __GNUC_MINOR__<3)
#define PB_DS pb_ds
#else
#define PB_DS __gnu_pbds
#endif
#endif // __GNUC__
/**
* At least for now, trie implementation is based on gcc policy-based data containers
*
* Important!!! This trie simplifies/optimizes work with IPv4 prefixes.
* There is an assumption that nobody will use IP netmasks other than 255.255.255.0, 255.255.0.0, 255.0.0.0, or 0.0.0.0.
* As a result, branching happens on a byte level, not on bit a level.
*/
namespace ns3 {
/**
* \brief IPv4 version of element-access traits for patricia trie
*
* Refer to http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/trie_based_containers.html
*/
class Ipv4AddressTrieEAccessTraits
{
public:
// Size type.
typedef size_t size_type;
// Key type.
typedef Ipv4Address key_type;
// Const key reference type.
typedef const Ipv4Address & const_key_reference;
// Element const iterator type.
typedef const uint8_t * const_iterator;
// Element type.
typedef uint8_t e_type;
enum
{
min_e_val = 0,
max_e_val = 255,
max_size = max_e_val - min_e_val + 1
};
public:
// Returns a const_iterator to the first element of r_key.
inline static const_iterator
begin (const_key_reference r_key);
// Returns a const_iterator to the after-last element of r_key.
inline static const_iterator
end (const_key_reference r_key);
// Maps an element to a position.
inline static size_type
e_pos (e_type e);
};
Ipv4AddressTrieEAccessTraits::const_iterator
Ipv4AddressTrieEAccessTraits::begin (Ipv4AddressTrieEAccessTraits::const_key_reference r_key)
{
return reinterpret_cast<Ipv4AddressTrieEAccessTraits::const_iterator> (&r_key.Get ());
}
Ipv4AddressTrieEAccessTraits::const_iterator
Ipv4AddressTrieEAccessTraits::end (Ipv4AddressTrieEAccessTraits::const_key_reference r_key)
{
return sizeof (r_key.Get ()) + reinterpret_cast<Ipv4AddressTrieEAccessTraits::const_iterator> (&r_key.Get ());
}
Ipv4AddressTrieEAccessTraits::size_type
Ipv4AddressTrieEAccessTraits::e_pos (Ipv4AddressTrieEAccessTraits::e_type e)
{
return e;
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
#include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp>
#define PB_DS_BASE_C_DEC \
PB_DS::detail::trie_policy_base<Const_Node_Iterator,Node_Iterator,E_Access_Traits,Allocator>
template<typename Const_Node_Iterator,
class Node_Iterator,
class E_Access_Traits,
class Allocator>
class TrieLongestPrefixMatch : private PB_DS_BASE_C_DEC
{
private:
typedef PB_DS_BASE_C_DEC base_type;
public:
typedef typename base_type::key_type key_type;
typedef typename base_type::const_key_reference const_key_reference;
// Element access traits.
typedef E_Access_Traits e_access_traits;
// Const element iterator.
typedef typename e_access_traits::const_iterator const_e_iterator;
// Allocator type.
typedef Allocator allocator;
// Size type.
typedef typename allocator::size_type size_type;
typedef PB_DS::detail::null_node_metadata metadata_type;
typedef Const_Node_Iterator const_node_iterator;
typedef Node_Iterator node_iterator;
typedef typename const_node_iterator::value_type const_iterator;
typedef typename node_iterator::value_type iterator;
inline const_iterator
longest_prefix_match (const_key_reference r_key)
{
return longest_prefix_match (
get_e_access_traits().begin (r_key),
get_e_access_traits().end (r_key));
}
inline const_iterator
longest_prefix_match (typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e)
{
if (empty())
return (end());
node_iterator nd_it = node_begin ();
node_iterator end_nd_it = node_end ();
const e_access_traits& r_traits = get_e_access_traits ();
const size_type given_range_length = std::distance (b, e);
while (true)
{
if (nd_it == end_nd_it) return end ();
const size_type common_range_length =
base_type::common_prefix_len (nd_it, b, e, r_traits);
if (common_range_length >= given_range_length) // not sure what this condition is for...
{
return rightmost_it (nd_it);
}
nd_it = next_child (nd_it, b, e, end_nd_it, r_traits);
}
}
protected:
inline void
operator()(node_iterator node_it, const_node_iterator end_nd_it) const
{
}
private:
// Returns true if the container is empty.
virtual bool
empty() const = 0;
// Returns the const iterator associated with the just-after last element.
virtual const_iterator
end() const = 0;
// Returns the iterator associated with the just-after last element.
virtual iterator
end() = 0;
// Returns the const_node_iterator associated with the trie's root node.
virtual const_node_iterator
node_begin() const = 0;
// Returns the node_iterator associated with the trie's root node.
virtual node_iterator
node_begin() = 0;
// Returns the const_node_iterator associated with a just-after leaf node.
virtual const_node_iterator
node_end() const = 0;
// Returns the node_iterator associated with a just-after leaf node.
virtual node_iterator
node_end() = 0;
// Access to the cmp_fn object.
virtual const e_access_traits&
get_e_access_traits() const = 0;
node_iterator
next_child(node_iterator nd_it, const_e_iterator b, const_e_iterator e,
node_iterator end_nd_it, const e_access_traits &r_traits)
{
const size_type num_children = nd_it.num_children();
node_iterator ret = end_nd_it;
size_type max_length = 0;
for (size_type i = 0; i < num_children; ++i)
{
node_iterator pot = nd_it.get_child (i);
const size_type common_range_length =
PB_DS_BASE_C_DEC::common_prefix_len (pot, b, e, r_traits);
if (common_range_length > max_length)
{
ret = pot;
max_length = common_range_length;
}
}
return (ret);
}
};
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
template<class MappedValue>
class Ipv4AddressTrie : public PB_DS::trie<Ipv4Address,MappedValue,Ipv4AddressTrieEAccessTraits,
PB_DS::pat_trie_tag,TrieLongestPrefixMatch>
{
};
} // namespace ns3
#endif // _TRIE_H_
+1
View File
@@ -124,6 +124,7 @@ def build(bld):
'utils/simple-channel.h',
'utils/simple-net-device.h',
'utils/pcap-test.h',
'utils/trie.h',
'helper/application-container.h',
'helper/net-device-container.h',
'helper/node-container.h',
+6 -10
View File
@@ -76,11 +76,9 @@ DynamicGlobalRoutingTestCase::~DynamicGlobalRoutingTestCase ()
void
DynamicGlobalRoutingTestCase::SinkRx (std::string path, Ptr<const Packet> p, const Address& address)
{
Ipv4PacketInfoTag tag;
bool found;
found = p->PeekPacketTag (tag);
Ptr<const Ipv4PacketInfoTag> tag = p->PeekPacketTag<Ipv4PacketInfoTag> ();
uint8_t now = static_cast<uint8_t> (Simulator::Now ().GetSeconds ());
if (found)
if (tag != 0)
{
;
}
@@ -99,17 +97,15 @@ DynamicGlobalRoutingTestCase::HandleRead (Ptr<Socket> socket)
{ //EOF
break;
}
Ipv4PacketInfoTag tag;
bool found;
found = packet->PeekPacketTag (tag);
Ptr<const Ipv4PacketInfoTag> tag = packet->PeekPacketTag<Ipv4PacketInfoTag> ();
uint8_t now = static_cast<uint8_t> (Simulator::Now ().GetSeconds ());
if (found)
if (tag != 0)
{
if (tag.GetRecvIf () == 1)
if (tag->GetRecvIf () == 1)
{
m_firstInterface[now]++;
}
if (tag.GetRecvIf () == 2)
if (tag->GetRecvIf () == 2)
{
m_secondInterface[now]++;
}
@@ -78,8 +78,6 @@ def register_types(module):
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], 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::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], 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::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], 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::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## nstime.h (module 'core'): ns3::Time [class]
@@ -89,7 +87,7 @@ def register_types(module):
## nstime.h (module 'core'): ns3::Time [class]
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader [class]
module.add_class('TopologyReader', parent=root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
module.add_class('TopologyReader', parent=root_module['ns3::Object'])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link [class]
module.add_class('Link', outer_class=root_module['ns3::TopologyReader'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
@@ -186,7 +184,6 @@ def register_methods(root_module):
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> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TopologyReader_methods(root_module, root_module['ns3::TopologyReader'])
@@ -377,9 +374,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 const & ns3::Ipv4Address::Get() const [member function]
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
cls.add_method('Get',
'uint32_t const &',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
@@ -1384,18 +1381,6 @@ def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter< ns3::TopologyReader > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
@@ -1576,6 +1561,11 @@ def register_Ns3TopologyReader_methods(root_module, cls):
'std::string',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::TopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## topology-reader.h (module 'topology-read'): std::_List_const_iterator<ns3::TopologyReader::Link> ns3::TopologyReader::LinksBegin() const [member function]
cls.add_method('LinksBegin',
'std::_List_const_iterator< ns3::TopologyReader::Link >',
@@ -1610,8 +1600,6 @@ def register_Ns3TopologyReader_methods(root_module, cls):
def register_Ns3TopologyReaderLink_methods(root_module, cls):
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::TopologyReader::Link const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TopologyReader::Link const &', 'arg0')])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link() [constructor]
cls.add_constructor([])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::Ptr<ns3::Node> fromPtr, std::string const & fromName, ns3::Ptr<ns3::Node> toPtr, std::string const & toName) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'fromPtr'), param('std::string const &', 'fromName'), param('ns3::Ptr< ns3::Node >', 'toPtr'), param('std::string const &', 'toName')])
## topology-reader.h (module 'topology-read'): std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ns3::TopologyReader::Link::AttributesBegin() [member function]
@@ -1632,11 +1620,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
'bool',
[param('std::string const &', 'name'), param('std::string &', 'value')],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetFromNetDevice() const [member function]
cls.add_method('GetFromNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetFromNode() const [member function]
cls.add_method('GetFromNode',
'ns3::Ptr< ns3::Node >',
@@ -1647,11 +1630,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
'std::string',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetToNetDevice() const [member function]
cls.add_method('GetToNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetToNode() const [member function]
cls.add_method('GetToNode',
'ns3::Ptr< ns3::Node >',
@@ -1666,10 +1644,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
cls.add_method('SetAttribute',
'void',
[param('std::string const &', 'name'), param('std::string const &', 'value')])
## topology-reader.h (module 'topology-read'): void ns3::TopologyReader::Link::SetNetDevices(ns3::Ptr<ns3::NetDevice> from, ns3::Ptr<ns3::NetDevice> to) [member function]
cls.add_method('SetNetDevices',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'from'), param('ns3::Ptr< ns3::NetDevice >', 'to')])
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
@@ -1860,6 +1834,11 @@ def register_Ns3EmptyAttributeValue_methods(root_module, cls):
return
def register_Ns3InetTopologyReader_methods(root_module, cls):
## inet-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::InetTopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## inet-topology-reader.h (module 'topology-read'): ns3::InetTopologyReader::InetTopologyReader() [constructor]
cls.add_constructor([])
## inet-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::InetTopologyReader::Read() [member function]
@@ -2245,6 +2224,11 @@ def register_Ns3Node_methods(root_module, cls):
return
def register_Ns3OrbisTopologyReader_methods(root_module, cls):
## orbis-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::OrbisTopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## orbis-topology-reader.h (module 'topology-read'): ns3::OrbisTopologyReader::OrbisTopologyReader() [constructor]
cls.add_constructor([])
## orbis-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::OrbisTopologyReader::Read() [member function]
@@ -2255,6 +2239,11 @@ def register_Ns3OrbisTopologyReader_methods(root_module, cls):
return
def register_Ns3RocketfuelTopologyReader_methods(root_module, cls):
## rocketfuel-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::RocketfuelTopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::RocketfuelTopologyReader::RocketfuelTopologyReader() [constructor]
cls.add_constructor([])
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::RocketfuelTopologyReader::Read() [member function]
@@ -78,8 +78,6 @@ def register_types(module):
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], 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::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], 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::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], 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::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## nstime.h (module 'core'): ns3::Time [class]
@@ -89,7 +87,7 @@ def register_types(module):
## nstime.h (module 'core'): ns3::Time [class]
root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader [class]
module.add_class('TopologyReader', parent=root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
module.add_class('TopologyReader', parent=root_module['ns3::Object'])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link [class]
module.add_class('Link', outer_class=root_module['ns3::TopologyReader'])
## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
@@ -186,7 +184,6 @@ def register_methods(root_module):
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> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3Time_methods(root_module, root_module['ns3::Time'])
register_Ns3TopologyReader_methods(root_module, root_module['ns3::TopologyReader'])
@@ -377,9 +374,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 const & ns3::Ipv4Address::Get() const [member function]
## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function]
cls.add_method('Get',
'uint32_t const &',
'uint32_t',
[],
is_const=True)
## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function]
@@ -1384,18 +1381,6 @@ def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > const & o) [copy constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter< ns3::TopologyReader > > const &', 'o')])
## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::Cleanup() [member function]
cls.add_method('Cleanup',
'void',
[],
is_static=True)
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
@@ -1576,6 +1561,11 @@ def register_Ns3TopologyReader_methods(root_module, cls):
'std::string',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::TopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## topology-reader.h (module 'topology-read'): std::_List_const_iterator<ns3::TopologyReader::Link> ns3::TopologyReader::LinksBegin() const [member function]
cls.add_method('LinksBegin',
'std::_List_const_iterator< ns3::TopologyReader::Link >',
@@ -1610,8 +1600,6 @@ def register_Ns3TopologyReader_methods(root_module, cls):
def register_Ns3TopologyReaderLink_methods(root_module, cls):
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::TopologyReader::Link const & arg0) [copy constructor]
cls.add_constructor([param('ns3::TopologyReader::Link const &', 'arg0')])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link() [constructor]
cls.add_constructor([])
## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link::Link(ns3::Ptr<ns3::Node> fromPtr, std::string const & fromName, ns3::Ptr<ns3::Node> toPtr, std::string const & toName) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'fromPtr'), param('std::string const &', 'fromName'), param('ns3::Ptr< ns3::Node >', 'toPtr'), param('std::string const &', 'toName')])
## topology-reader.h (module 'topology-read'): std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ns3::TopologyReader::Link::AttributesBegin() [member function]
@@ -1632,11 +1620,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
'bool',
[param('std::string const &', 'name'), param('std::string &', 'value')],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetFromNetDevice() const [member function]
cls.add_method('GetFromNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetFromNode() const [member function]
cls.add_method('GetFromNode',
'ns3::Ptr< ns3::Node >',
@@ -1647,11 +1630,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
'std::string',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::NetDevice> ns3::TopologyReader::Link::GetToNetDevice() const [member function]
cls.add_method('GetToNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[],
is_const=True)
## topology-reader.h (module 'topology-read'): ns3::Ptr<ns3::Node> ns3::TopologyReader::Link::GetToNode() const [member function]
cls.add_method('GetToNode',
'ns3::Ptr< ns3::Node >',
@@ -1666,10 +1644,6 @@ def register_Ns3TopologyReaderLink_methods(root_module, cls):
cls.add_method('SetAttribute',
'void',
[param('std::string const &', 'name'), param('std::string const &', 'value')])
## topology-reader.h (module 'topology-read'): void ns3::TopologyReader::Link::SetNetDevices(ns3::Ptr<ns3::NetDevice> from, ns3::Ptr<ns3::NetDevice> to) [member function]
cls.add_method('SetNetDevices',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'from'), param('ns3::Ptr< ns3::NetDevice >', 'to')])
return
def register_Ns3TraceSourceAccessor_methods(root_module, cls):
@@ -1860,6 +1834,11 @@ def register_Ns3EmptyAttributeValue_methods(root_module, cls):
return
def register_Ns3InetTopologyReader_methods(root_module, cls):
## inet-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::InetTopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## inet-topology-reader.h (module 'topology-read'): ns3::InetTopologyReader::InetTopologyReader() [constructor]
cls.add_constructor([])
## inet-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::InetTopologyReader::Read() [member function]
@@ -2245,6 +2224,11 @@ def register_Ns3Node_methods(root_module, cls):
return
def register_Ns3OrbisTopologyReader_methods(root_module, cls):
## orbis-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::OrbisTopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## orbis-topology-reader.h (module 'topology-read'): ns3::OrbisTopologyReader::OrbisTopologyReader() [constructor]
cls.add_constructor([])
## orbis-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::OrbisTopologyReader::Read() [member function]
@@ -2255,6 +2239,11 @@ def register_Ns3OrbisTopologyReader_methods(root_module, cls):
return
def register_Ns3RocketfuelTopologyReader_methods(root_module, cls):
## rocketfuel-topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::RocketfuelTopologyReader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::RocketfuelTopologyReader::RocketfuelTopologyReader() [constructor]
cls.add_constructor([])
## rocketfuel-topology-reader.h (module 'topology-read'): ns3::NodeContainer ns3::RocketfuelTopologyReader::Read() [member function]
@@ -55,7 +55,7 @@ RocketfuelTopologyReaderTest::DoRun (void)
std::string input ("./src/topology-read/examples/RocketFuel_toposample_1239_weights.txt");
inFile = CreateObject<RocketfuelTopologyReader> ();
inFile = Create<RocketfuelTopologyReader> ();
inFile->SetFileName (input);
if (inFile != 0)
+1 -8
View File
@@ -428,7 +428,7 @@ UanPhyGen::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::UanPhyGen")
.SetParent<UanPhy> ()
.SetParent<Object> ()
.AddConstructor<UanPhyGen> ()
.AddAttribute ("CcaThreshold",
"Aggregate energy of incoming signals to move to CCA Busy state dB",
@@ -581,14 +581,12 @@ UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, U
if (m_disabled)
{
NS_LOG_DEBUG ("Energy depleted, node cannot receive any packet. Dropping.");
NotifyRxDrop(pkt); // traced source netanim
return;
}
switch (m_state)
{
case TX:
NotifyRxDrop(pkt); // traced source netanim
NS_ASSERT (false);
break;
case RX:
@@ -597,7 +595,6 @@ UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, U
double newSinrDb = CalculateSinrDb (m_pktRx, m_pktRxArrTime, m_rxRecvPwrDb, m_pktRxMode, m_pktRxPdp);
m_minRxSinrDb = (newSinrDb < m_minRxSinrDb) ? newSinrDb : m_minRxSinrDb;
NS_LOG_DEBUG ("PHY " << m_mac->GetAddress () << ": Starting RX in RX mode. SINR of pktRx = " << m_minRxSinrDb);
NotifyRxBegin(pkt); // traced source netanim
}
break;
@@ -626,7 +623,6 @@ UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, U
{
m_state = RX;
UpdatePowerConsumption (RX);
NotifyRxBegin(pkt); // traced source netanim
m_rxRecvPwrDb = rxPowerDb;
m_minRxSinrDb = newsinr;
m_pktRx = pkt;
@@ -642,7 +638,6 @@ UanPhyGen::StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, U
break;
case SLEEP:
NS_LOG_DEBUG ("Sleep mode. Dropping packet.");
NotifyRxDrop(pkt); // traced source netanim
break;
}
@@ -666,11 +661,9 @@ UanPhyGen::RxEndEvent (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode)
{
NS_LOG_DEBUG ("Sleep mode or dead. Dropping packet");
m_pktRx = 0;
NotifyRxDrop(pkt); // traced source netanim
return;
}
NotifyRxEnd(pkt); // traced source netanim
if (GetInterferenceDb ( (Ptr<Packet>) 0) > m_ccaThreshDb)
{
m_state = CCABUSY;
+1
View File
@@ -241,6 +241,7 @@ private:
TracedCallback<Ptr<const Packet>, double, UanTxMode > m_rxErrLogger;
TracedCallback<Ptr<const Packet>, double, UanTxMode > m_txLogger;
double CalculateSinrDb (Ptr<Packet> pkt, Time arrTime, double rxPowerDb, UanTxMode mode, UanPdp pdp);
double GetInterferenceDb (Ptr<Packet> pkt);
double DbToKp (double db);
+1 -57
View File
@@ -69,64 +69,8 @@ NS_OBJECT_ENSURE_REGISTERED (UanPhy);
TypeId UanPhy::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::UanPhy")
.SetParent<Object> ()
.AddTraceSource ("PhyTxBegin",
"Trace source indicating a packet has begun transmitting over the channel medium",
MakeTraceSourceAccessor (&UanPhy::m_phyTxBeginTrace))
.AddTraceSource ("PhyTxEnd",
"Trace source indicating a packet has been completely transmitted over the channel.",
MakeTraceSourceAccessor (&UanPhy::m_phyTxEndTrace))
.AddTraceSource ("PhyTxDrop",
"Trace source indicating a packet has been dropped by the device during transmission",
MakeTraceSourceAccessor (&UanPhy::m_phyTxDropTrace))
.AddTraceSource ("PhyRxBegin",
"Trace source indicating a packet has begun being received from the channel medium by the device",
MakeTraceSourceAccessor (&UanPhy::m_phyRxBeginTrace))
.AddTraceSource ("PhyRxEnd",
"Trace source indicating a packet has been completely received from the channel medium by the device",
MakeTraceSourceAccessor (&UanPhy::m_phyRxEndTrace))
.AddTraceSource ("PhyRxDrop",
"Trace source indicating a packet has been dropped by the device during reception",
MakeTraceSourceAccessor (&UanPhy::m_phyRxDropTrace))
;
.SetParent<Object> ();
return tid;
}
void
UanPhy::NotifyTxBegin (Ptr<const Packet> packet)
{
m_phyTxBeginTrace (packet);
}
void
UanPhy::NotifyTxEnd (Ptr<const Packet> packet)
{
m_phyTxEndTrace (packet);
}
void
UanPhy::NotifyTxDrop (Ptr<const Packet> packet)
{
m_phyTxDropTrace (packet);
}
void
UanPhy::NotifyRxBegin (Ptr<const Packet> packet)
{
m_phyRxBeginTrace (packet);
}
void
UanPhy::NotifyRxEnd (Ptr<const Packet> packet)
{
m_phyRxEndTrace (packet);
}
void
UanPhy::NotifyRxDrop (Ptr<const Packet> packet)
{
m_phyRxDropTrace (packet);
}
} // namespace ns3
-85
View File
@@ -382,91 +382,6 @@ public:
virtual void Clear (void) = 0;
virtual void SetSleepMode (bool sleep) = 0;
/**
* Public method used to fire a PhyTxBegin trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxBegin (Ptr<const Packet> packet);
/**
* Public method used to fire a PhyTxEnd trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxEnd (Ptr<const Packet> packet);
/**
* Public method used to fire a PhyTxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyTxDrop (Ptr<const Packet> packet);
/**
* Public method used to fire a PhyRxBegin trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxBegin (Ptr<const Packet> packet);
/**
* Public method used to fire a PhyRxEnd trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxEnd (Ptr<const Packet> packet);
/**
* Public method used to fire a PhyRxDrop trace. Implemented for encapsulation
* purposes.
*/
void NotifyRxDrop (Ptr<const Packet> packet);
private:
/**
* The trace source fired when a packet begins the transmission process on
* the medium.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
/**
* The trace source fired when a packet ends the transmission process on
* the medium.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
/**
* The trace source fired when the phy layer drops a packet as it tries
* to transmit it.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
/**
* The trace source fired when a packet begins the reception process from
* the medium.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
/**
* The trace source fired when a packet ends the reception process from
* the medium.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_phyRxEndTrace;
/**
* The trace source fired when the phy layer drops a packet it has received.
*
* \see class CallBackTraceSource
*/
TracedCallback<Ptr<const Packet> > m_phyRxDropTrace;
};
}

Some files were not shown because too many files have changed in this diff Show More