Compare 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
956 changed files with 17013 additions and 95486 deletions

No files matched your search

+2 -1
View File
@@ -45,4 +45,5 @@ massif.*
\#[^\#/]+\#$
.lock-wscript
.lock-wafbuild
*~
\#*\#
+7 -8
View File
@@ -20,15 +20,15 @@
\.pcap$
\.mob$
\.routes$
^doc/doxygen.log$
^doc/doxygen.warnings.log$
^doc/(manual|models|tutorial|tutorial-pt-br)/build
^doc/(manual|models|tutorial|tutorial-pt-br)/figures/.*\.(eps|pdf|png)$
^doc/manual/build
^doc/tutorial/build
^doc/testing/build
^doc/models/build
^doc/models/source-temp
^doc/ns3_html_theme/static/ns3_version.js$
^doc/manual/figures/.*eps
^doc/manual/figures/.*pdf
^doc/manual/figures/.*png
^src/.*/doc/build
^src/.*/doc/source/figures/.*\.(eps|pdf)$
^src/.*/doc/.*\.png
^bindings/python/pybindgen/
ms_print.*
massif.*
@@ -36,4 +36,3 @@ massif.*
\.diff$
\.tr$
\#[^\#/]+\#$
syntax: glob
-3
View File
@@ -61,6 +61,3 @@ e48ed3aabca6ad71c8c49e4604c0f83345eda6a8 ns-3.11-RC3
19c9e2b33b4a53f200be80cd49810bdfecf76770 ns-3.12-RC1
167fc2274f53d4d89fdd769e4a7683ad7b6b7157 ns-3.12
9007193fbb8d18b69a1feb6aec16501dcf138b6f ns-3.13
ae540de68a2534213342c5e0b12afb47d7518a90 ns-3.14
26a511d6dbad7284e66de0f3b2ad5bebe6b76405 ns-3.15
49d343e55caec257bb01e400eef6c14522f37e1b ns-3.16
+10 -18
View File
@@ -1,15 +1,14 @@
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)
Nicola Baldo (nbaldo@cttc.es)
Mirko Banchi (mk.banchi@gmail.com)
Peter D. Barnes, Jr. (barnes26@llnl.gov)
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)
@@ -23,26 +22,22 @@ Andrey Churin (aachurin@gmail.com)
Salva Climent (jocliba@gmail.com)
Luis Cortes (cortes@gatech.edu)
Luca Costantino (luca.costantino@gmail.com)
Alexander D'souza (moijes12@gmail.com)
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)
Eric Gamess (egamess@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)
Maja Grubišić (maja.grubisic@live.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)
@@ -51,7 +46,6 @@ Flavio Kobuta (flaviokubota@gmail.com)
Aleksey Kovalenko (kovalenko@iitp.ru)
Mathieu Lacage (mathieu.lacage@inria.fr)
Emmanuelle Laprise (emmmanuelle.laprise@bluekazoo.ca)
Daniel Lertpratchya (nikkipui@gmail.com)
Björn Lichtblau (lichtbla@informatik.hu-berlin.de)
Keith Ma (keith.nwsuaf@gmail.com)
Federico Maguolo (maguolof@dei.unipd.it)
@@ -72,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)
@@ -89,12 +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)
Brian Swenson (bswenson3@gatech.edu)
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)
@@ -110,4 +103,3 @@ Mitch Watrous (watrous@u.washington.edu)
Florian Westphal (fw@strlen.de)
He Wu (mdzz@u.washington.edu)
Yoshihiko Yazawa (yoshiyaz@gmail.com)
Dizhi Zhou (dizhi.zhou@gmail.com)
+1 -106
View File
@@ -23,13 +23,6 @@ the impact of these changes on users by documenting these changes in a
single place (this file), and not by providing a temporary or permanent
backward-compatibility software layer. </p>
<p>
A related file is the RELEASE_NOTES file in the top level directory.
This file complements RELEASE_NOTES by focusing on API and behavioral
changes that users upgrading from one release to the next may encounter.
RELEASE_NOTES attempts to comprehensively list all of the changes
that were made. There is generally some overlap in the information
contained in RELEASE_NOTES and this file. </p>
<p>
The goal is that users who encounter a problem when trying to use older
code with newer code should be able to consult this file to find
guidance as to how to fix the problem. For instance, if a method name
@@ -51,105 +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.16 to ns-3.17</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.15 to ns-3.16</h1>
<h2>New API:</h2>
<ul>
<li>In the Socket class, the following functions were added:
<ul>
<li>(Set/Get)IpTos - sets IP Type of Service field in the IP headers.</li>
<li>(Set/Is)IpRecvTos - tells the socket to pass information about IP ToS up the stack (by adding SocketIpTosTag to the packet).</li>
<li>(Set/Get)IpTtl - sets IP Time to live field in the IP headers.</li>
<li>(Set/Is)RecvIpTtl - tells the socket to pass information about IP TTL up the stack (by adding SocketIpTtlTag to the packet).</li>
<li>(Set/Is)Ipv6Tclass - sets Traffic Class field in the IPv6 headers.</li>
<li>(Set/Is)Ipv6RecvTclass - tells the socket to pass information about IPv6 TCLASS up the stack (by adding SocketIpv6TclassTag to the packet).</li>
<li>(Set/Get)Ipv6HopLimit - sets Hop Limit field in the IPv6 headers.</li>
<li>(Set/Is)Ipv6RecvHopLimit - tells the socket to pass information about IPv6 HOPLIMIT up the stack (by adding SocketIpv6HoplimitTag to the packet).</li>
</ul>
A user can call these functions to set/get the corresponding socket option. See examples/socket/socket-options-ipv4.cc and examples/socket/socket-options-ipv6.cc for examples.
</ul>
<h2>Changes to existing API:</h2>
<ul>
<li>In the MobilityHelper class, the functions EnableAscii () and EnableAsciiAll () were changed to use output stream wrappers rather than standard C++ ostreams. The purpose of this change was to make them behave analogously to other helpers in ns-3 that generate ascii traces. Now, the file stream that is open in MobilityHelper is closed nicely upon asserts and program exits.</li>
</ul>
<h2>Changes to build system:</h2>
<ul>
<li>It's now possible to use distcc when building ns-3. See tutorial for details.</li>
</ul>
<h2>Changed behavior:</h2>
<ul>
<li>Sending a packet through Ipv4RawSocket now supports checksum in the Ipv4Header. It is still not possible to manually put in arbitrary checksum as the checksum is automatically calculated at Ipv4L3Protocol. The user has to enable checksum globally for this to work. Simply calling Ipv4Header::EnableChecksum() for a single Ipv4Header will not work.</li>
<li>Now MultiModelSpectrumChannel allows a SpectrumPhy instance to change SpectrumModel at runtime by issuing a call to MultiModelSpectrumChannel::AddRx (). Previously, MultiModelSpectrumChannel required each SpectrumPhy instance to stick with the same SpectrumModel for the whole simulation.
</li>
</ul>
<hr>
<h1>Changes from ns-3.14 to ns-3.15</h1>
<h2>New API:</h2>
<ul>
<li>A RandomVariableStreamHelper has been introduced to assist with
using the Config subsystem path names to assign fixed stream numbers
to RandomVariableStream objects.</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>
<li>Derived classes of RandomVariable (i.e. the random variable
implementations) have been ported to a new RandomVariableStream base class.
<li>For a given distribution DistributionVariable (such as UniformVariable),
the new class name is DistributionRandomVariable (such as
UniformRandomVariable). </li>
<li>The new implementations are also derived from class ns3::Object and
are handled using the ns-3 smart pointer (Ptr) class. </li>
<li>The new variable classes also have a new attributed called "Stream"
which allows them to be assigned to a fix stream index when assigned
to the underlying pseudo-random stream of numbers.</li>
</li>
</ul>
<h2>Changes to build system:</h2>
<ul>
<li></li>
</ul>
<h2>Changed behavior:</h2>
<ul>
<li>Programs using random variables or models that include random variables
may exhibit changed output for a given run number or seed, due to a possible
change in the order in which random variables are assigned to underlying
pseudo-random sequences. Consult the manual for more information regarding
this.</li>
</ul>
<hr>
<h1>Changes from ns-3.13 to ns-3.14</h1>
<h1>Changes from ns-3.13 to ns-3-dev</h1>
<h2>New API:</h2>
<ul>
-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 -181
View File
@@ -9,204 +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
-------------------
To be determined
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.16
============
Availability
------------
This release is available from:
http://www.nsnam.org/release/ns-allinone-3.16.tar.bz2
Supported platforms
-------------------
- Fedora Core 17 (32/64 bit) with g++-4.7.0
- Fedora Core 15 (64 bit) with g++-4.6.3
- Ubuntu 12.10 (32/64 bit) with g++-4.6.3
- Ubuntu 12.04 (32/64 bit) with g++-4.6.3
- Ubuntu 10.04.4 LTS (64 bit) with g++-4.4.3
- OS X Mountain Lion 10.8.3 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
-------------------------
- Support several new LTE MAC schedulers developed in GSoC 2012 project.
Those schedulers include FD-MT, TD-MT, TTA, FD-BET, TD-BET, FD-TBFQ,
TD-TBFQ, PSS. Here, FD and TD mean frequency domain and time domain
respectively.
- It's now possible to use distcc when building ns-3 by using
$ CXX='distcc g++' ./waf configure
$ ./waf build
- Support topology generation with the (external) BRITE topology generation
tool
Bugs fixed
----------
- bug 555 - DCF immediate access
- bug 976 - wifi-wired-bridging regression test fails because of
rounding errors in mobility model
- bug 1055: Wrong UAN's Thorp absorption loss model formula
- bug 1284 - ./test.py performance tests do not exist
- bug 1324 - ns3tcp-cwnd-test-suite.cc test failing
- bug 1340 - ns3tcp-loss-suite.cc tests failing
- bug 1342 - ns3tcp-cwnd-test-suite.cc tests failing
- bug 1345 - ns-3 builds with clang compiler >= 3.0
- bug 1359 - TCP cannot receive ICMP
- bug 1361 - Set TOS from Application level (sockets)
- bug 1463 - ./test.py --example should automatically detect the path
- bug 1479 - When the Ipv4RawSocket "IpHeaderInclude" Attribute set true,
Ip Checksum error
- bug 1485 - Setting global properties in config file (raw text) does
not have any effect
- bug 1493 - test.py --list should show the test type default tip
- bug 1493 - test.py --list should show the test type
- bug 1494 - test.py --constrain doesn't work
- bug 1495 - test.py claims test passed when no test was run
- bug 1506: TCP data segment piggybacking acknowledgment
- bug 1509 - RttEstimator returns invalid value in presence of errors
- bug 1516 - GtkConfigStore does not show read-only attributes
- bug 1520 - Config paths not fully documented (partial fix)
- bug 1524 - Fragmentation Threshold equals to Packet Size at MAC Layer
(Data + IP + UDP) crash the reception
- bug 1525 - Linker error with mpi on Mac 10.8
- bug 1526: Wrong calculation of pathloss within
UanPropModelThorp::GetPathLossDb
- bug 1527 - Ipv4RawSocket's BindToNetDevice not working
- bug 1528 - BindToNetDevice not working for IPv6 sockets
- bug 1531 - Crash when using NS_LOG in destructors of static objects
- bug 1532 - unimplemented LTE Scheduler methods
Known issues
------------
In general, known issues are tracked on the project tracker available
at http://www.nsnam.org/bugzilla/
Release 3.15
============
Availability
------------
This release is available from:
http://www.nsnam.org/release/ns-allinone-3.15.tar.bz2
Supported platforms
-------------------
- Fedora Core 17 (32/64 bit) with g++-4.7.0
- Fedora Core 15 (64 bit) with g++-4.6.3
- Ubuntu 12.04 (32/64 bit) with g++-4.6.3
- Ubuntu 10.04.4 LTS (64 bit) with g++-4.4.3
- OS X Mountain Lion 10.7.4 with g++-4.2.1
- OS X Snow Leopard 10.6.8 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
-------------------------
- A new random variable base class called 'RandomVariableStream', has been
introduced. This base class derives from ns3::Object, unlike the current
'RandomVariable' class which is a special type of object in the ns-3
system to date. By making this class derive from ns3::Object, it can be
handled with the Ptr class, can carry attributes, and can have its parameters
and initial state saved in the config-store subsystem. A new attribute
called "Stream" has been introduced for this class, to allow users to
better control the assignment of underlying pseudo-random sequences to
the RandomVariableStream objects (bug 101).
Bugs fixed
----------
- bug 101 - random variable initialization
- bug 1256 - Unnecessary SND.NXT advance, missing ACK for Out of Order segments
- bug 1308 - Nix-vector; do not process packets to self
- bug 1386 - assert if PositionAllocator not provided to
RandomWaypointMobilityModel
- bug 1399 - TCP not backing off retransmissions properly
- bug 1441 - IPv4 header length handling
- bug 1464 - ConfigStore Save + Load => Could not set default value
for ns3::UdpSocketImpl::IcmpCallback
- bug 1470 - define default parameter for constructor in .h file
- bug 1473 - GetQueue/SetQueue missing from Csma python bindings
- bug 1475 - "test.py --list" should sort the output
- bug 1476 - TestCase::GetName () should not be private
- bug 1477 - Click doesn't work with raw sockets
- bug 1481 - Openflow example doesn't run
- bug 1486 - Segfaults in nix-vector-routing with bridges
- bug 1489 - Jakes Log component is missing
- fixed bug with multiple LCs in UL BSR
- fixed bug with lena-dual-stripe crashes with --homeUesHomeEnbRatio=2
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
@@ -218,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",
@@ -226,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
@@ -271,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
@@ -409,6 +409,7 @@ class python_scan_task_collector(Task.TaskBase):
# can't cope with it, so we have to force the user to restart
# WAF)
self.bld.producer.stop = 1
self.bld.producer.free_task_pool()
return 0
File renamed without changes.
+157 -448
View File
File diff suppressed because it is too large. Load diff
-133
View File
@@ -1,133 +0,0 @@
#!/bin/bash
# Process doxygen.warnings.log to generate sorted list of top offenders
# Flag to skip running doxygen
skipdoxy=${1:-""}
DIR=`dirname $0`
ROOT=`hg root`
# Final resting place for the log file
log=$DIR/doxygen.warnings.log
# First, we have to modify doxygen.conf to generate all the warnings
# (We also suppress dot graphs, so shorten the run time.)
if [ "$skipdoxy" == "" ]; then
conf=$DIR/doxygen.conf
sed -i.bak -E '/^EXTRACT_ALL |^HAVE_DOT |^WARNINGS /s/YES/no/' $conf
rm -f $conf.bak
echo -n "Rebuilding doxygen docs with full errors..."
(cd $ROOT && ./waf --doxygen >/dev/null 2>&1)
status=$?
hg revert $conf
if [ "$status" = "0" ]; then
echo "Done."
else
echo "FAILED."
exit 1
fi
mv $DIR/doxygen.log $log
else
echo "Skipping doxygen run, using existing log file $log"
fi
# Analyze the log
# List of module directories (e.g, "src/core/model")
undocmods=$( \
grep "^$ROOT" "$log" | \
cut -d ':' -f 1 | \
sed "s|$ROOT||g" | \
cut -d '/' -f 2-4 | \
sort | \
uniq -c | \
sort -nr \
)
# Number of directories
modcount=$( \
echo "$undocmods" | \
wc -l | \
sed 's/^[ \t]*//;s/[ \t]*$//' \
)
# For a function with multiple undocumented parameters,
# Doxygen prints the additional parameters on separate lines,
# so they don't show up in the totals above.
# Rather than work too hard to get the exact number,
# we just list the total here.
addlparam=$( \
grep -v "^$ROOT" $log | \
grep -v "not generated, too many nodes" | \
grep "^ parameter '" $log | \
wc -l | \
sed 's/^[ \t]*//;s/[ \t]*$//' \
)
# Total number of warnings
warncount=$(echo "$undocmods" | \
awk '{total += $1}; END {print total}' )
warncount=$((warncount + addlparam))
# List of files appearing in the log
undocfiles=$( \
grep "^$ROOT" "$log" | \
cut -d ':' -f 1 | \
sed "s|$ROOT||g" | \
cut -d '/' -f 2- | \
sort | \
uniq -c | \
sort -k 2 \
)
# Total number of files
filecount=$( \
echo "$undocfiles" | \
wc -l | \
sed 's/^[ \t]*//;s/[ \t]*$//' \
)
# Now we're ready to summarize the log
echo
echo "Report of Doxygen warnings"
echo "----------------------------------------"
echo
echo "(All counts are lower bounds.)"
echo
echo "Warnings by module/directory:"
echo
echo "Count Directory"
echo "----- ----------------------------------"
echo "$undocmods"
echo " $addlparam additional undocumented parameters."
echo "----------------------------------------"
printf "%6d total warnings\n" $warncount
printf "%6d directories with warnings\n" $modcount
echo
echo
echo "Warnings by file"
echo
echo "Count File"
echo "----- ----------------------------------"
echo "$undocfiles"
echo "----------------------------------------"
printf "%6d files with warnings\n" $filecount
echo
echo
echo "Doxygen Warnings Summary"
echo "----------------------------------------"
printf "%6d directories\n" $modcount
printf "%6d files\n" $filecount
printf "%6d warnings\n" $warncount
+1 -3
View File
@@ -31,9 +31,7 @@ IMAGES_TO_CLEAN = $(IMAGES_PNG_CONVERTED) $(IMAGES_PDF) $(IMAGES_EPS)
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps;
$(EPSTOPDF) $< -o=$@
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
%.pdf : %.eps; $(EPSTOPDF) $< -o=$@; if test x$($@_width) != x; then TMPFILE=`mktemp`; ./rescale-pdf.sh $($@_width) $@ $${TMPFILE} && mv $${TMPFILE} $@; fi
# You can set these variables from the command line.
Binary file not shown.
+2 -4
View File
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
TMPDIR=/tmp
TMPFILE=`mktemp`
echo "\documentclass{book}
@@ -10,5 +8,5 @@ echo "\documentclass{book}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}" >${TMPFILE}.tex
pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}
cp ${TMPFILE}.pdf ${3}
+7 -14
View File
@@ -856,25 +856,18 @@ presentation.
To use this feature, one must install libgtk and libgtk-dev; an example
Ubuntu installation command is:::
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
To check whether it is configured or not, check the output of the step:::
./waf configure --enable-examples --enable-tests
./waf configure --enable-examples --enable-tests
---- Summary of optional NS-3 features:
Python Bindings : enabled
Python API Scanning Support : enabled
NS-3 Click Integration : enabled
GtkConfigStore : not enabled (library 'gtk+-2.0 >= 2.12' not found)
---- Summary of optional NS-3 features:
Threading Primitives : enabled
Real Time Simulator : enabled
GtkConfigStore : not enabled (library 'gtk+-2.0 >= 2.12' not found)
In the above example, it was not enabled, so it cannot be used until a suitable
version is installed and::
./waf configure --enable-examples --enable-tests
./waf
is rerun.
version is installed and ./waf configure --enable-examples --enable-tests; ./waf is rerun.
Usage is almost the same as the non-GTK-based version, but there
are no ConfigStore attributes involved:::
-330
View File
@@ -253,333 +253,3 @@ Here is an example of the usage::
SpecificFunctor<A, int> sf(&a, &A::Hello);
sf(5);
}
.. note:: The previous code is not real ns-3 code. It is simplistic example
code used only to illustrate the concepts involved and to help you understand
the system more. Do not expect to find this code anywhere in the ns-3 tree.
Notice that there are two variables defined in the class above. The m_p
variable is the object pointer and m_pmi is the variable containing the
address of the function to execute.
Notice that when ``operator()`` is called, it in turn calls the method provided
with the object pointer using the C++ PMI syntax.
To use this, one could then declare some model code that takes a generic functor
as a parameter::
void LibraryFunction (Functor functor);
The code that will talk to the model would build a specific functor and pass it to ``LibraryFunction``::
MyClass myClass;
SpecificFunctor<MyClass, int> functor (&myclass, MyClass::MyMethod);
When ``LibraryFunction`` is done, it executes the callback using the
``operator()`` on the generic functor it was passed, and in this particular
case, provides the integer argument::
void
LibraryFunction (Functor functor)
{
// Execute the library function
functor(1234);
}
Notice that ``LibraryFunction`` is completely decoupled from the specific
type of the client. The connection is made through the Functor polymorphism.
The Callback API in |ns3| implements object-oriented callbacks using
the functor mechanism. This callback API, being based on C++ templates, is
type-safe; that is, it performs static type checks to enforce proper signature
compatibility between callers and callees. It is therefore more type-safe to
use than traditional function pointers, but the syntax may look imposing at
first. This section is designed to walk you through the Callback system so
that you can be comfortable using it in |ns3|.
Using the Callback API
**********************
The Callback API is fairly minimal, providing only two services:
1. callback type declaration: a way to declare a type of callback
with a given signature, and,
2. callback instantiation: a way to instantiate a
template-generated forwarding callback which can forward any calls
to another C++ class member method or C++ function.
This is best observed via walking through an example, based on
``samples/main-callback.cc``.
Using the Callback API with static functions
++++++++++++++++++++++++++++++++++++++++++++
Consider a function::
static double
CbOne (double a, double b)
{
std::cout << "invoke cbOne a=" << a << ", b=" << b << std::endl;
return a;
}
Consider also the following main program snippet::
int main (int argc, char *argv[])
{
// return type: double
// first arg type: double
// second arg type: double
Callback<double, double, double> one;
}
This is an example of a C-style callback -- one which does not include or need
a ``this`` pointer. The function template ``Callback`` is essentially the
declaration of the variable containing the pointer-to-function. In the example
above, we explicitly showed a pointer to a function that returned an integer and
took a single integer as a parameter, The ``Callback`` template function is
a generic version of that -- it is used to declare the type of a callback.
.. note:: Readers unfamiliar with C++ templates may consult `<http://www.cplusplus.com/doc/tutorial/templates/>`_.
The ``Callback`` template requires one mandatory argument (the return type
of the function to be assigned to this callback) and up to five optional
arguments, which each specify the type of the arguments (if your particular
callback function has more than five arguments, then this can be handled
by extending the callback implementation).
So in the above example, we have a declared a callback named "one" that will
eventually hold a function pointer. The signature of the function that it will
hold must return double and must support two double arguments. If one tries
to pass a function whose signature does not match the declared callback,
a compilation error will occur. Also, if one tries to assign to a callback
an incompatible one, compilation will succeed but a run-time
NS_FATAL_ERROR will be raised. The sample program
``src/core/examples/main-callback.cc`` demonstrates both of these error cases
at the end of the ``main()`` program.
Now, we need to tie together this callback instance and the actual target function
(CbOne). Notice above that CbOne has the same function signature types as the
callback-- this is important. We can pass in any such properly-typed function
to this callback. Let's look at this more closely::
static double CbOne (double a, double b) {}
^ ^ ^
| ---| ------|
| | |
Callback<double, double, double> one;
You can only bind a function to a callback if they have the matching signature.
The first template argument is the return type, and the additional template
arguments are the types of the arguments of the function signature.
Now, let's bind our callback "one" to the function that matches its signature::
// build callback instance which points to cbOne function
one = MakeCallback (&CbOne);
This call to ``MakeCallback`` is, in essence, creating one of the specialized
functors mentioned above. The variable declared using the ``Callback``
template function is going to be playing the part of the generic functor. The
assignment ``one = MakeCallback (&CbOne)`` is the cast that converts the
specialized functor known to the callee to a generic functor known to the caller.
Then, later in the program, if the callback is needed, it can be used as follows::
NS_ASSERT (!one.IsNull ());
// invoke cbOne function through callback instance
double retOne;
retOne = one (10.0, 20.0);
The check for ``IsNull()`` ensures that the callback is not null -- that there
is a function to call behind this callback. Then, ``one()`` executes the
generic ``operator()`` which is really overloaded with a specific implementation
of ``operator()`` and returns the same result as if ``CbOne()`` had been
called directly.
Using the Callback API with member functions
++++++++++++++++++++++++++++++++++++++++++++
Generally, you will not be calling static functions but instead public member
functions of an object. In this case, an extra argument is needed to the
MakeCallback function, to tell the system on which object the function should be
invoked. Consider this example, also from main-callback.cc::
class MyCb {
public:
int CbTwo (double a) {
std::cout << "invoke cbTwo a=" << a << std::endl;
return -5;
}
};
int main ()
{
...
// return type: int
// first arg type: double
Callback<int, double> two;
MyCb cb;
// build callback instance which points to MyCb::cbTwo
two = MakeCallback (&MyCb::CbTwo, &cb);
...
}
Here, we pass an additional object pointer to the ``MakeCallback<>`` function.
Recall from the background section above that ``Operator()`` will use the pointer to
member syntax when it executes on an object::
virtual int operator() (ARG arg)
{
(*m_p.*m_pmi)(arg);
}
And so we needed to provide the two variables (``m_p`` and ``m_pmi``) when
we made the specific functor. The line::
two = MakeCallback (&MyCb::CbTwo, &cb);
does precisely that. In this case, when ``two ()`` is invoked::
int result = two (1.0);
will result in a call tothe ``CbTwo`` member function (method) on the object
pointed to by ``&cb``.
Building Null Callbacks
+++++++++++++++++++++++
It is possible for callbacks to be null; hence it may be wise to
check before using them. There is a special construct for a null
callback, which is preferable to simply passing "0" as an argument;
it is the ``MakeNullCallback<>`` construct::
two = MakeNullCallback<int, double> ();
NS_ASSERT (two.IsNull ());
Invoking a null callback is just like invoking a null function pointer: it will
crash at runtime.
Bound Callbacks
***************
A very useful extension to the functor concept is that of a Bound Callback.
Previously it was mentioned that closures were originally function calls
packaged up for later execution. Notice that in all of the Callback
descriptions above, there is no way to package up any parameters for use
later -- when the ``Callback`` is called via ``operator()``. All of
the parameters are provided by the calling function.
What if it is desired to allow the client function (the one that provides the
callback) to provide some of the parameters? `Alexandrescu <http://erdani.com/book/main.html>`_ calls the process of
allowing a client to specify one of the parameters *"binding"*. One of the
parameters of ``operator()`` has been bound (fixed) by the client.
Some of our pcap tracing code provides a nice example of this. There is a
function that needs to be called whenever a packet is received. This function
calls an object that actually writes the packet to disk in the pcap file
format. The signature of one of these functions will be::
static void DefaultSink (Ptr<PcapFileWrapper> file, Ptr<const Packet> p);
The static keyword means this is a static function which does not need a
``this`` pointer, so it will be using C-style callbacks. We don't want the
calling code to have to know about anything but the Packet. What we want in
the calling code is just a call that looks like::
m_promiscSnifferTrace (m_currentPkt);
What we want to do is to *bind* the ``Ptr<PcapFileWriter> file`` to the
specific callback implementation when it is created and arrange for the
``operator()`` of the Callback to provide that parameter for free.
We provide the ``MakeBoundCallback`` template function for that purpose. It
takes the same parameters as the ``MakeCallback`` template function but also
takes the parameters to be bound. In the case of the example above::
MakeBoundCallback (&DefaultSink, file);
will create a specific callback implementation that knows to add in the extra
bound arguments. Conceptually, it extends the specific functor described above
with one or more bound arguments::
template <typename T, typename ARG, typename BOUND_ARG>
class SpecificFunctor : public Functor
{
public:
SpecificFunctor(T* p, int (T::*_pmi)(ARG arg), BOUND_ARG boundArg)
{
m_p = p;
m_pmi = pmi;
m_boundArg = boundArg;
}
virtual int operator() (ARG arg)
{
(*m_p.*m_pmi)(m_boundArg, arg);
}
private:
void (T::*m_pmi)(ARG arg);
T* m_p;
BOUND_ARG m_boundArg;
};
You can see that when the specific functor is created, the bound argument is saved
in the functor / callback object itself. When the ``operator()`` is invoked with
the single parameter, as in::
m_promiscSnifferTrace (m_currentPkt);
the implementation of ``operator()`` adds the bound parameter into the actual
function call::
(*m_p.*m_pmi)(m_boundArg, arg);
Traced Callbacks
****************
*Placeholder subsection*
Callback locations in ns-3
**************************
Where are callbacks frequently used in |ns3|? Here are some of the
more visible ones to typical users:
* Socket API
* Layer-2/Layer-3 API
* Tracing subsystem
* API between IP and routing subsystems
Implementation details
**********************
The code snippets above are simplistic and only designed to illustrate the mechanism
itself. The actual Callback code is quite complicated and very template-intense and
a deep understanding of the code is not required. If interested, expert users may
find the following useful.
The code was originally written based on the techniques described in
`<http://www.codeproject.com/cpp/TTLFunction.asp>`_.
It was subsequently rewritten to follow the architecture outlined in
`Modern C++ Design, Generic Programming and Design Patterns Applied, Alexandrescu, chapter 5, Generalized Functors <http://www.moderncppdesign.com/book/main.html>`_.
This code uses:
* default template parameters to saves users from having to
specify empty parameters when the number of parameters
is smaller than the maximum supported number
* the pimpl idiom: the Callback class is passed around by
value and delegates the crux of the work to its pimpl pointer.
* two pimpl implementations which derive from CallbackImpl
FunctorCallbackImpl can be used with any functor-type
while MemPtrCallbackImpl can be used with pointers to
member functions.
* a reference list implementation to implement the Callback's
value semantics.
This code most notably departs from the Alexandrescu implementation in that it
does not use type lists to specify and pass around the types of the callback
arguments. Of course, it also does not use copy-destruction semantics and
relies on a reference list rather than autoPtr to hold the pointer.
+5 -5
View File
@@ -91,7 +91,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'ns3_html_theme'
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -99,11 +99,11 @@ html_theme = 'ns3_html_theme'
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['../..']
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = 'Manual'
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
@@ -124,7 +124,7 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y %H:%M'
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
@@ -184,7 +184,7 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = '../../ns3_html_theme/static/ns-3.png'
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
-199
View File
@@ -1,199 +0,0 @@
.. include:: replace.txt
.. heading hierarchy:
------------- Chapter
************* Section (#.#)
============= Subsection (#.#.#)
############# Paragraph (no number)
Events and Simulator
--------------------
|ns3| is a discrete-event network simulator. Conceptually, the simulator
keeps track of a number of events that are scheduled to execute at a
specified simulation time. The job of the simulator is to execute the
events in sequential time order. Once the completion of an event occurs,
the simulator will move to the next event (or will exit if there are no
more events in the event queue). If, for example, an event scheduled
for simulation time "100 seconds" is executed, and the next event is not
scheduled until "200 seconds", the simulator will immediately jump from
100 seconds to 200 seconds (of simulation time) to execute the next event.
This is what is meant by "discrete-event" simulator.
To make this all happen, the simulator needs a few things:
1) a simulator object that can access an event queue where events are
stored and that can manage the execution of events
2) a scheduler responsible for inserting and removing events from the queue
3) a way to represent simulation time
4) the events themselves
This chapter of the manual describes these fundamental objects
(simulator, scheduler, time, event) and how they are used.
Event
*****
*To be completed*
Simulator
*********
The Simulator class is the public entry point to access event scheduling
facilities. Once a couple of events have been scheduled to start the
simulation, the user can start to execute them by entering the simulator
main loop (call Simulator::Run). Once the main loop starts running, it
will sequentially execute all scheduled events in order from oldest to
most recent until there are either no more events left in the event
queue or Simulator::Stop has been called.
To schedule events for execution by the simulator main loop, the
Simulator class provides the Simulator::Schedule* family of functions.
1) Handling event handlers with different signatures
These functions are declared and implemented as C++ templates to handle
automatically the wide variety of C++ event handler signatures used in
the wild. For example, to schedule an event to execute 10 seconds in the
future, and invoke a C++ method or function with specific arguments, you
might write this:
::
void handler (int arg0, int arg1)
{
std::cout << "handler called with argument arg0=" << arg0 << " and
arg1=" << arg1 << std::endl;
}
Simulator::Schedule(Seconds(10), &handler, 10, 5);
Which will output:
::
handler called with argument arg0=10 and arg1=5
Of course, these C++ templates can also handle transparently member
methods on C++ objects:
*To be completed: member method example*
Notes:
* the ns-3 Schedule methods recognize automatically functions and
methods only if they take less than 5 arguments. If you need them to
support more arguments, please, file a bug report.
* Readers familiar with the term 'fully-bound functors' will recognize
the Simulator::Schedule methods as a way to automatically construct such
objects.
2) Common scheduling operations
The Simulator API was designed to make it really simple to schedule most
events. It provides three variants to do so (ordered from most commonly
used to least commonly used):
* Schedule methods which allow you to schedule an event in the future
by providing the delay between the current simulation time and the
expiration date of the target event.
* ScheduleNow methods which allow you to schedule an event for the
current simulation time: they will execute _after_ the current event is
finished executing but _before_ the simulation time is changed for the
next event.
* ScheduleDestroy methods which allow you to hook in the shutdown
process of the Simulator to cleanup simulation resources: every
'destroy' event is executed when the user calls the Simulator::Destroy
method.
3) Maintaining the simulation context
There are two basic ways to schedule events, with and without *context*.
What does this mean?
::
Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj);
vs.
::
Simulator::ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj);
Readers who invest time and effort in developing or using a non-trivial
simulation model will know the value of the ns-3 logging framework to
debug simple and complex simulations alike. One of the important
features that is provided by this logging framework is the automatic
display of the network node id associated with the 'currently' running
event.
The node id of the currently executing network node is in fact tracked
by the Simulator class. It can be accessed with the
Simulator::GetContext method which returns the 'context' (a 32-bit
integer) associated and stored in the currently-executing event. In some
rare cases, when an event is not associated with a specific network
node, its 'context' is set to 0xffffffff.
To associate a context to each event, the Schedule, and ScheduleNow
methods automatically reuse the context of the currently-executing event
as the context of the event scheduled for execution later.
In some cases, most notably when simulating the transmission of a packet
from a node to another, this behavior is undesirable since the expected
context of the reception event is that of the receiving node, not the
sending node. To avoid this problem, the Simulator class provides a
specific schedule method: ScheduleWithContext which allows one to
provide explicitly the node id of the receiving node associated with
the receive event.
*XXX: code example*
In some very rare cases, developers might need to modify or understand
how the context (node id) of the first event is set to that of its
associated node. This is accomplished by the NodeList class: whenever a
new node is created, the NodeList class uses ScheduleWithContext to
schedule a 'start' event for this node. The 'start' event thus executes
with a context set to that of the node id and can use the normal variety
of Schedule methods. It invokes the Node::Start method which propagates
the 'start' event by calling the DoStart method for each object
associated with the node. The DoStart method overridden in some of these
objects (most notably in the Application base class) will schedule some
events (most notably Application::StartApplication) which will in turn
scheduling traffic generation events which will in turn schedule
network-level events.
Notes:
* Users need to be careful to propagate DoStart methods across objects
by calling Start explicitely on their member objects
* The context id associated with each ScheduleWithContext method has
other uses beyond logging: it is used by an experimental branch of ns-3
to perform parallel simulation on multicore systems using
multithreading.
The Simulator::* functions do not know what the context is: they
merely make sure that whatever context you specify with
ScheduleWithContext is available when the corresponding event executes
with ::GetContext.
It is up to the models implemented on top of Simulator::* to interpret
the context value. In ns-3, the network models interpret the context
as the node id of the node which generated an event. This is why it is
important to call ScheduleWithContext in ns3::Channel subclasses
because we are generating an event from node i to node j and we want
to make sure that the event which will run on node j has the right
context.
Time
****
*To be completed*
Scheduler
*********
*To be completed*
+6 -88
View File
@@ -11,11 +11,10 @@ be asked to contribute test code. Models that you contribute will be
used for many years by other people, who probably have no idea upon
first glance whether the model is correct. The test code that you
write for your model will help to avoid future regressions in
the output and will aid future users in understanding the verification
the output and will aid future users in understanding the validity
and bounds of applicability of your models.
There are many ways to verify the correctness of a model's implementation.
In this section,
There are many ways to test that a model is valid. In this chapter,
we hope to cover some common cases that can be used as a guide to
writing new tests.
@@ -32,96 +31,15 @@ TestSuite), these things need to be decided up front:
separately in src/test/ directory). You will have to edit the wscript
file in that directory to compile your new code, if it is a new file.
A program called ``src/create-module.py`` is a good starting point.
This program can be invoked such as ``create-module.py router`` for
a hypothetical new module called ``router``. Once you do this, you
will see a ``router`` directory, and a ``test/router-test-suite.cc``
test suite. This file can be a starting point for your initial test.
This is a working test suite, although the actual tests performed are
trivial. Copy it over to your module's test directory, and do a global
substitution of "Router" in that file for something pertaining to
the model that you want to test. You can also edit things such as a
more descriptive test case name.
See the file ``src/template/test/sample-test-suite.cc`` and corresponding
wscript file in that directory for a simple example, and see the directories
under ``src/test`` for more complicated examples.
You also need to add a block into your wscript to get this test to
compile:
::
module_test.source = [
'test/router-test-suite.cc',
]
Before you actually start making this do useful things, it may help
to try to run the skeleton. Make sure that ns-3 has been configured with
the "--enable-tests" option. Let's assume that your new test suite
is called "router" such as here:
::
RouterTestSuite::RouterTestSuite ()
: TestSuite ("router", UNIT)
Try this command:
::
./test.py -s router
Output such as below should be produced:
::
PASS: TestSuite router
1 of 1 tests passed (1 passed, 0 skipped, 0 failed, 0 crashed, 0 valgrind errors)
See src/lte/test/test-lte-antenna.cc for a worked example.
Test macros
***********
There are a number of macros available for checking test program
output with expected output. These macros are defined in
``src/core/model/test.h``.
The main set of macros that are used include the following:
::
NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
The first argument ``actual`` is the value under test, the second value
``limit`` is the expected value (or the value to test against), and the
last argument ``msg`` is the error message to print out if the test fails.
The first four macros above test for equality, inequality, less than, or
greater than, respectively. The fifth macro above tests for equality,
but within a certain tolerance. This variant is useful when testing
floating point numbers for equality against a limit, where you want to
avoid a test failure due to rounding errors.
Finally, there are variants of the above where the keyword ``ASSERT``
is replaced by ``EXPECT``. These variants are designed specially for
use in methods (especially callbacks) returning void. Reserve their
use for callbacks that you use in your test programs; otherwise,
use the ``ASSERT`` variants.
*The rest of this chapter remains to be written*
How to add an example program to the test suite
***********************************************
One can "smoke test" that examples compile and run successfully
to completion (without memory leaks) using the ``examples-to-run.py``
script located in your module's test directory. Briefly, by including
an instance of this file in your test directory, you can cause the
test runner to execute the examples listed. It is usually best to make
sure that you select examples that have reasonably short run times so as
to not bog down the tests. See the example in ``src/lte/test/``
directory.
Testing for boolean outcomes
****************************
-1
View File
@@ -18,7 +18,6 @@ This document is written in `reStructuredText <http://docutils.sourceforge.net/r
organization
random-variables
events
callbacks
object-model
attributes
+2 -153
View File
@@ -1,158 +1,7 @@
.. include:: replace.txt
.. heading hierarchy:
------------- Chapter
************* Section (#.#)
============= Subsection (#.#.#)
############# Paragraph (no number)
Logging
-------
The |ns3| logging facility can be used to monitor or debug the progress
of simulation programs. Logging output can be enabled by program statements
in your ``main()`` program or by the use of the ``NS_LOG`` environment variable.
Logging statements are not compiled into optimized builds of |ns3|. To use
logging, one must build the (default) debug build of |ns3|.
The project makes no guarantee about whether logging output will remain
the same over time. Users are cautioned against building simulation output
frameworks on top of logging code, as the output and the way the output
is enabled may change over time.
Logging overview
****************
|ns3| logging statements are typically used to log various program
execution events, such as the occurrence of simulation events or the
use of a particular function.
For example, this code snippet is from ``Ipv4L3Protocol::IsDestinationAddress()``:
::
if (address == iaddr.GetBroadcast ())
{
NS_LOG_LOGIC ("For me (interface broadcast address)");
return true;
}
If logging has been enabled for the ``Ipv4L3Protocol`` component at a level
of ``LOGIC`` or above (see below about logging levels), the statement
will be printed out; otherwise, it will be suppressed.
Logging levels
==============
The following levels are defined; each level will enable the levels above
it, with the ``ALL`` level being most verbose:
#. ``LOG_NONE``: the default, no logging
#. ``LOG_ERROR``: serious error messages only
#. ``LOG_WARN``: warning messages
#. ``LOG_DEBUG``: for use in debugging
#. ``LOG_FUNCTION``: function tracing
#. ``LOG_LOGIC``: control flow tracing within functions
#. ``LOG_ALL``: print everything
A special logging level will cause logging output to unconditionally
appear on ``std::clog``, regardless of whether the user has explicitly enabled
logging.
This macro, ``NS_LOG_UNCOND()``, can be used like a kind of ``printf()`` in
your code. An example can be found in ``scratch/scratch-simulator.cc``:
::
NS_LOG_UNCOND ("Scratch Simulator");
Logging prefixes
================
This section still needs documentation; bug 1496 is open on this:
::
$ NS_LOG="*=all|prefix_all" ./waf --run scratch-simulator
Scratch Simulator
ScratchSimulator:main(): [ERROR] error message
ScratchSimulator:main(): [WARN] warn message
ScratchSimulator:main(): [DEBUG] debug message
ScratchSimulator:main(): [INFO] info message
ScratchSimulator:main(function)
ScratchSimulator:main(): [LOGIC] logic message
Enabling logging output
=======================
There are two ways that users typically control logging output. The
first is by setting an ``NS_LOG`` environment variable; e.g.:
::
NS_LOG="*" ./waf --run first
will run the first tutorial program with all logging output. This can
be made more granular by selecting individual components:
::
NS_LOG="Ipv4L3Protocol" ./waf --run first
The second way to enable this is to use explicit statements in your
program, such as in the first tutorial program:
::
int
main (int argc, char *argv[])
{
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
...
Some helpers have special methods to enable the logging of all components
in a module (across different compilation units, but logically grouped
together such as the |ns3| wifi code:
::
WifiHelper wifiHelper;
wifiHelper.EnableLogComponents ();
How to add logging to your code
*******************************
To add logging to your code, please follow the below steps:
1) Put ``NS_LOG_COMPONENT_DEFINE`` macro outside of namespace ns3
Create a unique string identifier (usually based on the name of the file
and/or class defined within the file) and register it with a macro call
such as follows:
::
NS_LOG_COMPONENT_DEFINE ("Ipv4L3Protocol");
namespace ns3 {
...
The macro was carefully written to permit inclusion either within or
outside of namespace ``ns3``, and usage will vary across the codebase, but
the original intent was to register this *outside* of namespace ``ns3``.
2) Add logging statements to your functions and function bodies.
There are a couple of guidelines on this:
* Do *not* add function logging in operators or explicit copy constructors,
since these will cause infinite recursion and stack overflow.
* Use the ``NS_LOG_FUNCTION_NOARGS()`` variant for static methods *only*. When
a non-static member function has no arguments, it should be logged by
``NS_LOG_FUNCTION (this)`` macro.
* Make sure that you test that your logging changes do not break the code;
running some example programs with all log components turned on (e.g.
``NS_LOG="*"``) is one way to test this.
*This chapter not yet written. For now, the ns-3 tutorial contains logging
information.*
+10 -1
View File
@@ -174,7 +174,7 @@ sort, it makes sense to put it into the ``src/`` directory somewhere,
particularly for ease of integrating with the build system.
In the case of the error model, it is very related to the packet class, so it
makes sense to implement this in the ``src/network/`` module where |ns3|
makes sense to implement this in the ``src/network/model`` directory where |ns3|
packets are implemented.
waf and wscript
@@ -394,6 +394,15 @@ test program 1
Object Framework
++++++++++++++++
::
static const ClassId cid;
const InterfaceId ErrorModel::iid =
MakeInterfaceId ("ErrorModel", Object::iid);
const ClassId ErrorModel::cid =
MakeClassId<ErrorModel> ("ErrorModel", ErrorModel::iid);
Adding-a-sample-script
**********************
+55 -103
View File
@@ -12,7 +12,7 @@ Quick Overview
**************
|ns3| random numbers are provided via instances of
:cpp:class:`ns3::RandomVariableStream`.
:cpp:class:`ns3::RandomVariable`.
* by default, |ns3| simulations use a fixed seed; if there is any randomness in
the simulation, each run of the program will yield identical results unless
@@ -21,18 +21,13 @@ Quick Overview
* in *ns-3.3* and earlier, |ns3| simulations used a random seed by default; this
marks a change in policy starting with *ns-3.4*.
* in *ns-3.14* and earlier, |ns3| simulations used a different wrapper class
called :cpp:class:`ns3::RandomVariable`. As of *ns-3.15*, this class has been
replaced by :cpp:class:`ns3::RandomVariableStream`; the underlying pseudo-random
number generator has not changed.
* to obtain randomness across multiple simulation runs, you must either set the
seed differently or set the run number differently. To set a seed, call
:cpp:func:`ns3::RngSeedManager::SetSeed` at the beginning of the program; to set
a run number with the same seed, call :cpp:func:`ns3::RngSeedManager::SetRun` at
:cpp:func:`ns3::SeedManager::SetSeed` at the beginning of the program; to set
a run number with the same seed, call :cpp:func:`ns3::SeedManager::SetRun` at
the beginning of the program; see :ref:`seeding-and-independent-replications`.
* each RandomVariableStream used in |ns3| has a virtual random number generator
* each RandomVariable used in |ns3| has a virtual random number generator
associated with it; all random variables use either a fixed or random seed
based on the use of the global seed (previous bullet);
@@ -87,14 +82,14 @@ period (*i.e.*, the number of random numbers before overlap) of
:math:`7.6x10^{22}`. The period of the entire generator is :math:`3.1x10^{57}`.
Class :cpp:class:`ns3::RandomVariableStream` is the public interface to this
underlying random number generator. When users create new random variables
(such as :cpp:class:`ns3::UniformRandomVariable`,
:cpp:class:`ns3::ExponentialRandomVariable`, etc.), they create an object that uses
Class :cpp:class:`ns3::RandomVariable` is the public interface to this
underlying random number generator. When users create new ``RandomVariables``
(such as :cpp:class:`ns3::UniformVariable`,
:cpp:class:`ns3::ExponentialVariable`, etc.), they create an object that uses
one of the distinct, independent streams of the random number generator.
Therefore, each object of type :cpp:class:`ns3::RandomVariableStream` has,
Therefore, each object of type :cpp:class:`ns3::RandomVariable` has,
conceptually, its own "virtual" RNG. Furthermore, each
:cpp:class:`ns3::RandomVariableStream` can be configured to use one of the set of
:cpp:class:`ns3::RandomVariable` can be configured to use one of the set of
substreams drawn from the main stream.
An alternate implementation would be to allow each RandomVariable to have its
@@ -120,15 +115,15 @@ so as to compute statistics on a large number of independent runs. The user can
either change the global seed and rerun the simulation, or can advance the
substream state of the RNG, which is referred to as incrementing the run number.
A class :cpp:class:`ns3::RngSeedManager` provides an API to control the seeding and
A class :cpp:class:`ns3::SeedManager` provides an API to control the seeding and
run number behavior. This seeding and substream state setting must be called
before any random variables are created; e.g::
RngSeedManager::SetSeed (3); // Changes seed from default of 1 to 3
RngSeedManager::SetRun (7); // Changes run number from default of 1 to 7
SeedManager::SetSeed (3); // Changes seed from default of 1 to 3
SeedManager::SetRun (7); // Changes run number from default of 1 to 7
// Now, create random variables
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
Ptr<ExponentialRandomVariable> y = CreateObject<ExponentialRandomVarlable> ();
UniformVariable x(0,10);
ExponentialVariable y(2902);
...
Which is better, setting a new seed or advancing the substream state? There is
@@ -159,16 +154,16 @@ or, if you are running programs directly outside of waf::
The above command-line variants make it easy to run lots of different
runs from a shell script by just passing a different RngRun index.
Class RandomVariableStream
**************************
Class RandomVariable
********************
All random variables should derive from class :cpp:class:`RandomVariable`. This
base class provides a few methods for globally configuring the behavior
base class provides a few static methods for globally configuring the behavior
of the random number generator. Derived classes provide API for drawing random
variates from the particular distribution being supported.
Each RandomVariableStream created in the simulation is given a generator that is a
new RNGStream from the underlying PRNG. Used in this manner, the L'Ecuyer
Each RandomVariable created in the simulation is given a generator that is a new
RNGStream from the underlying PRNG. Used in this manner, the L'Ecuyer
implementation allows for a maximum of :math:`1.8x10^19` random variables. Each
random variable in a single replication can produce up to :math:`7.6x10^22`
random numbers before overlapping.
@@ -176,7 +171,7 @@ random numbers before overlapping.
Base class public API
*********************
Below are excerpted a few public methods of class :cpp:class:`RandomVariableStream`
Below are excerpted a few public methods of class :cpp:class:`RandomVariable`
that access the next value in the substream.::
/**
@@ -186,7 +181,7 @@ that access the next value in the substream.::
double GetValue (void) const;
/**
* \brief Returns a random integer from the underlying distribution
* \brief Returns a random integer integer from the underlying distribution
* \return Integer cast of ::GetValue()
*/
uint32_t GetInteger (void) const;
@@ -198,33 +193,36 @@ Types of RandomVariables
************************
The following types of random variables are provided, and are documented in the
|ns3| Doxygen or by reading ``src/core/model/random-variable-stream.h``. Users
can also create their own custom random variables by deriving from class
:cpp:class:`RandomVariableStream`.
|ns3| Doxygen or by reading ``src/core/model/random-variable.h``. Users can also
create their own custom random variables by deriving from class
:cpp:class:`RandomVariable`.
* class :cpp:class:`UniformRandomVariable`
* class :cpp:class:`ConstantRandomVariable`
* class :cpp:class:`SequentialRandomVariable`
* class :cpp:class:`ExponentialRandomVariable`
* class :cpp:class:`ParetoRandomVariable`
* class :cpp:class:`WeibullRandomVariable`
* class :cpp:class:`NormalRandomVariable`
* class :cpp:class:`LogNormalRandomVariable`
* class :cpp:class:`GammaRandomVariable`
* class :cpp:class:`ErlangRandomVariable`
* class :cpp:class:`TriangularRandomVariable`
* class :cpp:class:`ZipfRandomVariable`
* class :cpp:class:`ZetaRandomVariable`
* class :cpp:class:`DeterministicRandomVariable`
* class :cpp:class:`EmpiricalRandomVariable`
* class :cpp:class:`UniformVariable`
* class :cpp:class:`ConstantVariable`
* class :cpp:class:`SequentialVariable`
* class :cpp:class:`ExponentialVariable`
* class :cpp:class:`ParetoVariable`
* class :cpp:class:`WeibullVariable`
* class :cpp:class:`NormalVariable`
* class :cpp:class:`EmpiricalVariable`
* class :cpp:class:`IntEmpiricalVariable`
* class :cpp:class:`DeterministicVariable`
* class :cpp:class:`LogNormalVariable`
* class :cpp:class:`TriangularVariable`
* class :cpp:class:`GammaVariable`
* class :cpp:class:`ErlangVariable`
* class :cpp:class:`ZipfVariable`
Semantics of RandomVariableStream objects
*****************************************
Semantics of RandomVariable objects
***********************************
RandomVariableStream objects derive from :cpp:class:`ns3::Object` and are
handled by smart pointers.
RandomVariable objects have value semantics. This means that they can be passed
by value to functions. The can also be passed by reference to const.
RandomVariables do not derive from :cpp:class:`ns3::Object` and we do not use
smart pointers to manage them; they are either allocated on the stack or else
users explicitly manage any heap-allocated RandomVariables.
RandomVariableStream instances can also be used in |ns3| attributes, which means
RandomVariable objects can also be used in |ns3| attributes, which means
that values can be set for them through the |ns3| attribute system.
An example is in the propagation models for WifiNetDevice:::
@@ -236,15 +234,15 @@ An example is in the propagation models for WifiNetDevice:::
.AddConstructor<RandomPropagationDelayModel> ()
.AddAttribute ("Variable",
"The random variable which generates random delays (s).",
StringValue ("ns3::UniformRandomVariable"),
MakePointerAccessor (&RandomPropagationDelayModel::m_variable),
MakePointerChecker<RandomVariableStream> ())
RandomVariableValue (UniformVariable (0.0, 1.0)),
MakeRandomVariableAccessor (&RandomPropagationDelayModel::m_variable),
MakeRandomVariableChecker ())
;
return tid;
}
Here, the |ns3| user can change the default random variable for this
delay model (which is a UniformRandomVariable ranging from 0 to 1) through
delay model (which is a UniformVariable ranging from 0 to 1) through
the attribute system.
Using other PRNG
@@ -254,56 +252,10 @@ There is presently no support for substituting a different underlying
random number generator (e.g., the GNU Scientific Library or the Akaroa
package). Patches are welcome.
Setting the stream number
*************************
More advanced usage
*******************
The underlying MRG32k3a generator provides 2^64 independent streams.
In ns-3, these are assigned sequentially starting from the first stream as
new RandomVariableStream instances make their first call to GetValue().
As a result of how these RandomVariableStream objects are assigned to
underlying streams, the assignment is sensitive to perturbations of
the simulation configuration. The consequence is that if any aspect of the
simulation configuration is changed, the mapping of RandomVariables to
streams may (or may not) change.
As a concrete example, a user running a comparative study between routing
protocols may find that the act of changing one routing protocol for another
will notice that the underlying mobility pattern also changed.
Starting with ns-3.15, some control has been provided to users to allow
users to optionally fix the assignment of selected RandomVariableStream
objects to underlying streams. This is the ``Stream`` attribute, part
of the base class RandomVariableStream.
By partitioning the existing sequence of streams from before:
::
<-------------------------------------------------------------------------->
stream 0 stream (2^64 - 1)
into two equal-sized sets:
::
<--------------------------------------------------------------------------->
^ ^^ ^
| || |
stream 0 stream (2^63 - 1) stream 2^63 stream (2^64 - 1)
<- automatically assigned -----><-------- assigned by user----------->
The first 2^63 streams continue to be automatically assigned, while
the last 2^63 are given stream indices starting with zero up to
2^63-1.
The assignment of streams to a fixed stream number is optional; instances
of RandomVariableStream that do not have a stream value assigned will
be assigned the next one from the pool of automatic streams.
To fix a RandomVariableStream to a particular underlying stream, assign
its ``Stream`` attribute to a non-negative integer (the default value
of -1 means that a value will be automatically allocated).
*To be completed.*
Publishing your results
***********************
+43 -92
View File
@@ -115,8 +115,7 @@ if you run ``test.py --help`` you should see a command summary like:
-c KIND, --constrain=KIND
constrain the test-runner by kind of test
-e EXAMPLE, --example=EXAMPLE
specify a single example to run (no relative path is
needed)
specify a single example to run (with relative path)
-g, --grind run the test suites and examples using valgrind
-k, --kinds print the kinds of tests available
-l, --list print the list of known tests
@@ -166,12 +165,6 @@ to be specified. Running the command
./test.py --suite=ns3-wifi-propagation-loss-models
or equivalently
::
./test.py -s ns3-wifi-propagation-loss-models
results in that single test suite being run.
::
@@ -286,12 +279,12 @@ Any of these listed suites can be selected to be run by itself using the
Similarly to test suites, one can run a single C++ example program
using the ``--example`` option. Note that the relative path for the
example does not need to be included and that the executables built
for C++ examples do not have extensions. Entering
example must be included and that the executables built for C++
examples do not have extensions. Entering
::
./test.py --example=udp-echo
./test.py --example=examples/udp/udp-echo
results in that single example being run.
@@ -304,7 +297,7 @@ You can specify the directory where ns-3 was built using the
::
./test.py --buildpath=/home/craigdo/repos/ns-3-allinone-test/ns-3-dev/build/debug --example=wifi-simple-adhoc
./test.py --buildpath=/home/craigdo/repos/ns-3-allinone-test/ns-3-dev/build/debug --example=examples/wireless/wifi-simple-adhoc
One can run a single Python example program using the ``--pyexample``
option. Note that the relative path for the example must be included
@@ -464,31 +457,10 @@ Performance tests are those which exercise a particular part of the system
and determine if the tests have executed to completion in a reasonable time.
Running Tests
*************
+++++++++++++
Tests are typically run using the high level ``test.py`` program. To get a list of the available command-line options, run ``test.py --help``
The test program ``test.py`` will run both tests and those examples that
have been added to the list to check. The difference between tests
and examples is as follows. Tests generally check that specific simulation
output or events conforms to expected behavior. In contrast, the output
of examples is not checked, and the test program merely checks the exit
status of the example program to make sure that it runs without error.
Briefly, to run all tests, first one must configure tests during configuration
stage, and also (optionally) examples if examples are to be checked:
::
./waf --configure --enable-examples --enable-tests
Then, build ns-3, and after it is built, just run ``test.py``. ``test.py -h``
will show a number of configuration options that modify the behavior
of test.py.
The program ``test.py`` invokes, for C++ tests and examples, a lower-level
C++ program called ``test-runner`` to actually run the tests. As discussed
below, this ``test-runner`` can be a helpful way to debug tests.
Debugging Tests
***************
@@ -569,10 +541,7 @@ directory tree looking for a directory file with files named ``VERSION`` and
``LICENSE.`` If it finds one, it assumes that must be the basedir and provides
it for you.
Test output
+++++++++++
Many test suites need to write temporary files (such as pcap files)
Similarly, many test suites need to write temporary files (such as pcap files)
in the process of running the tests. The tests then need a temporary directory
to write to. The Python test utility (test.py) will provide a temporary file
automatically, but if run stand-alone this temporary directory must be provided.
@@ -594,20 +563,6 @@ The time is provided as a hint so that you can relatively easily reconstruct
what directory was used if you need to go back and look at the files that were
placed in that directory.
Another class of output is test output like pcap traces that are generated
to compare to reference output. The test program will typically delete
these after the test suites all run. To disable the deletion of test
output, run ``test.py`` with the "retain" option:
::
./test.py -r
and test output can be found in the ``testpy-output/`` directory.
Reporting of test failures
++++++++++++++++++++++++++
When you run a test suite using the test-runner it will run the test quietly
by default. The only indication that you will get that the test passed is
the *absence* of a message from ``waf`` saying that the program
@@ -666,41 +621,6 @@ also not a complete XML file since test suites are designed to have their
output appended to a master XML status file as described in the ``test.py``
section.
Debugging test suite failures
+++++++++++++++++++++++++++++
To debug test crashes, such as::
CRASH: TestSuite ns3-wifi-interference
You can access the underlying test-runner program via gdb as follows, and
then pass the "--basedir=`pwd`" argument to run (you can also pass other
arguments as needed, but basedir is the minimum needed)::
./waf --command-template="gdb %s" --run "test-runner"
Waf: Entering directory `/home/tomh/hg/sep09/ns-3-allinone/ns-3-dev-678/build'
Waf: Leaving directory `/home/tomh/hg/sep09/ns-3-allinone/ns-3-dev-678/build'
'build' finished successfully (0.380s)
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
L cense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) r --basedir=`pwd`
Starting program: <..>/build/debug/utils/test-runner --basedir=`pwd`
[Thread debugging using libthread_db enabled]
assert failed. file=../src/core/model/type-id.cc, line=138, cond="uid <= m_information.size () && uid != 0"
...
Here is another example of how to use valgrind to debug a memory problem
such as::
VALGR: TestSuite devices-mesh-dot11s-regression
./waf --command-template="valgrind %s --basedir=`pwd` --suite=devices-mesh-dot11s-regression" --run test-runner
Class TestRunner
****************
@@ -786,7 +706,7 @@ case a name and override the ``DoRun`` method to run the test.
}
Utilities
*********
+++++++++
There are a number of utilities of various kinds that are also part of the
testing framework. Examples include a generalized pcap file useful for
@@ -794,6 +714,37 @@ storing test vectors; a generic container useful for transient storage of
test vectors during test execution; and tools for generating presentations
based on validation and verification testing results.
These utilities are not documented here, but for example, please see
how the TCP tests found in ``src/test/ns3tcp/`` use pcap files and reference
output.
Debugging test suite failures
+++++++++++++++++++++++++++++
To debug test crashes, such as::
CRASH: TestSuite ns3-wifi-interference
You can access the underlying test-runner program via gdb as follows, and
then pass the "--basedir=`pwd`" argument to run (you can also pass other
arguments as needed, but basedir is the minimum needed)::
./waf --command-template="gdb %s" --run "test-runner"
Waf: Entering directory `/home/tomh/hg/sep09/ns-3-allinone/ns-3-dev-678/build'
Waf: Leaving directory `/home/tomh/hg/sep09/ns-3-allinone/ns-3-dev-678/build'
'build' finished successfully (0.380s)
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
L cense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) r --basedir=`pwd`
Starting program: <..>/build/debug/utils/test-runner --basedir=`pwd`
[Thread debugging using libthread_db enabled]
assert failed. file=../src/core/model/type-id.cc, line=138, cond="uid <= m_information.size () && uid != 0"
...
Here is another example of how to use valgrind to debug a memory problem
such as::
VALGR: TestSuite devices-mesh-dot11s-regression
./waf --command-template="valgrind %s --basedir=`pwd` --suite=devices-mesh-dot11s-regression" --run test-runner
+8 -8
View File
@@ -26,7 +26,7 @@ output, as in, ::
int main ()
{
...
std::cout << "The value of x is " << x << std::endl;
std::cout << ``The value of x is `` << x << std::endl;
...
}
@@ -109,11 +109,11 @@ The Simplest Example
It will be useful to go walk a quick example just to reinforce what we've
said.::
#include "ns3/object.h"
#include "ns3/uinteger.h"
#include "ns3/traced-value.h""
#include "ns3/trace-source-accessor.h"
#include ``ns3/object.h''
#include ``ns3/uinteger.h''
#include ``ns3/traced-value.h''
#include ``ns3/trace-source-accessor.h''
#include <iostream>
@@ -167,7 +167,7 @@ callback process.::
void
IntTrace (Int oldValue, Int newValue)
{
std::cout << "Traced " << oldValue << " to " << newValue << std::endl;
std::cout << ``Traced `` << oldValue << `` to `` << newValue << std::endl;
}
This is the definition of the trace sink. It corresponds directly to a callback
@@ -199,7 +199,7 @@ context for now since it is not important yet.
Finally, the line,::
myObject->m_myInt = 1234;
myObject->m_myInt = 1234;
should be interpreted as an invocation of ``operator=`` on the member variable
``m_myInt`` with the integer :math:`1234` passed as a parameter. It turns out
+22 -27
View File
@@ -24,7 +24,6 @@ SOURCES = \
$(SRC)/aodv/doc/aodv.rst \
$(SRC)/applications/doc/applications.rst \
$(SRC)/bridge/doc/bridge.rst \
$(SRC)/brite/doc/brite.rst \
$(SRC)/buildings/doc/source/buildings.rst \
$(SRC)/buildings/doc/source/buildings-design.rst \
$(SRC)/buildings/doc/source/buildings-user.rst \
@@ -50,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 \
@@ -89,19 +87,20 @@ SOURCEFIGS = \
$(SRC)/wifi/doc/WifiArchitecture.dia \
$(SRC)/wifi/doc/snir.dia \
$(SRC)/wimax/doc/WimaxArchitecture.dia \
$(SRC)/lte/doc/source/figures/ff-mac-saps.dia \
$(SRC)/lte/doc/source/figures/ff-example.dia \
$(SRC)/lte/doc/source/figures/lte-enb-architecture.dia \
$(SRC)/lte/doc/source/figures/lte-ue-architecture.dia \
$(SRC)/lte/doc/source/figures/epc-profiling-scenario.dia \
$(SRC)/lte/doc/source/figures/eutran-profiling-scenario.dia \
$(SRC)/lte/doc/source/figures/lte-interference-test-scenario.dia \
$(SRC)/lte/doc/source/figures/epc-topology.dia \
$(SRC)/lte/doc/source/figures/epc-data-flow-dl.dia \
$(SRC)/lte/doc/source/figures/epc-data-flow-ul.dia \
$(SRC)/lte/doc/source/figures/epc-profiling-scenario.dia \
$(SRC)/lte/doc/source/figures/epc-topology.dia \
$(SRC)/lte/doc/source/figures/eutran-profiling-scenario.dia \
$(SRC)/lte/doc/source/figures/ff-example.dia \
$(SRC)/lte/doc/source/figures/ff-mac-saps.dia \
$(SRC)/lte/doc/source/figures/lte-arch-data-rrc-pdcp-rlc.dia \
$(SRC)/lte/doc/source/figures/lte-enb-architecture.dia \
$(SRC)/lte/doc/source/figures/lte-epc-e2e-data-protocol-stack.dia \
$(SRC)/lte/doc/source/figures/lte-interference-test-scenario.dia \
$(SRC)/lte/doc/source/figures/lte-ue-architecture.dia \
$(SRC)/lte/doc/source/figures/lte-subframe-structure.dia \
$(SRC)/lte/doc/source/figures/MCS_2_test.eps \
$(SRC)/lte/doc/source/figures/MCS_12_test.eps \
$(SRC)/lte/doc/source/figures/lena-dual-stripe.eps \
$(SRC)/lte/doc/source/figures/lte-mcs-index.eps \
$(SRC)/lte/doc/source/figures/lenaThrTestCase1.eps \
@@ -152,8 +151,6 @@ SOURCEFIGS = \
$(SRC)/lte/doc/source/figures/helpers.pdf \
$(SRC)/lte/doc/source/figures/miesm_scheme.pdf \
$(SRC)/lte/doc/source/figures/miesm_scheme.png \
$(SRC)/lte/doc/source/figures/lte-phy-interference.seqdiag \
$(SRC)/lte/doc/source/figures/helpers.seqdiag \
$(SRC)/uan/doc/auvmobility-classes.dia \
$(SRC)/stats/doc/Stat-framework-arch.png \
$(SRC)/stats/doc/Wifi-default.png \
@@ -197,19 +194,20 @@ IMAGES_EPS = \
$(FIGURES)/WifiArchitecture.eps \
$(FIGURES)/snir.eps \
$(FIGURES)/WimaxArchitecture.eps \
$(FIGURES)/ff-mac-saps.eps \
$(FIGURES)/ff-example.eps \
$(FIGURES)/lte-enb-architecture.eps \
$(FIGURES)/lte-ue-architecture.eps \
$(FIGURES)/epc-profiling-scenario.eps \
$(FIGURES)/eutran-profiling-scenario.eps \
$(FIGURES)/lte-interference-test-scenario.eps \
$(FIGURES)/epc-topology.eps \
$(FIGURES)/epc-data-flow-dl.eps \
$(FIGURES)/epc-data-flow-ul.eps \
$(FIGURES)/epc-profiling-scenario.eps \
$(FIGURES)/epc-topology.eps \
$(FIGURES)/eutran-profiling-scenario.eps \
$(FIGURES)/ff-example.eps \
$(FIGURES)/ff-mac-saps.eps \
$(FIGURES)/lte-arch-data-rrc-pdcp-rlc.eps \
$(FIGURES)/lte-enb-architecture.eps \
$(FIGURES)/lte-epc-e2e-data-protocol-stack.eps \
$(FIGURES)/lte-interference-test-scenario.eps \
$(FIGURES)/lte-ue-architecture.eps \
$(FIGURES)/lte-subframe-structure.eps \
$(FIGURES)/MCS_2_test.eps \
$(FIGURES)/MCS_12_test.eps \
$(FIGURES)/lena-dual-stripe.eps \
$(FIGURES)/lte-mcs-index.eps \
$(FIGURES)/lenaThrTestCase1.eps \
@@ -226,7 +224,7 @@ IMAGES_EPS = \
$(FIGURES)/lte-rlc-data-retx-dl.eps \
$(FIGURES)/lte-rlc-data-txon-ul.eps \
$(FIGURES)/lte-rlc-data-retx-ul.eps \
$(FIGURES)/auvmobility-classes.eps \
$(FIGURES)/auvmobility-classes.eps \
# rescale pdf figures as necessary
$(FIGURES)/testbed.pdf_width = 5in
@@ -252,7 +250,6 @@ $(FIGURES)/lte-rlc-data-txon-dl.pdf_width = 10cm
$(FIGURES)/lte-rlc-data-txon-ul.pdf_width = 10cm
$(FIGURES)/lte-rlc-data-retx-ul.pdf_width = 10cm
$(FIGURES)/lte-phy-interference.pdf_width = 12cm
$(FIGURES)/lte-subframe-structure.pdf_width = 2in
$(FIGURES)/auvmobility-classes.pdf_width = 10cm
IMAGES_PNG = ${IMAGES_EPS:.eps=.png}
@@ -263,9 +260,7 @@ IMAGES = $(IMAGES_EPS) $(IMAGES_PNG) $(IMAGES_PDF)
%.eps : %.dia; $(DIA) -t eps $< -e $@
%.png : %.dia; $(DIA) -t png $< -e $@
%.png : %.eps; $(CONVERT) $< $@
%.pdf : %.eps
$(EPSTOPDF) $< -o=$@
if test x$($@_width) != x; then ./rescale-pdf.sh $($@_width) $@ ; fi
%.pdf : %.eps; $(EPSTOPDF) $< -o=$@; if test x$($@_width) != x; then TMPFILE=`mktemp`; ./rescale-pdf.sh $($@_width) $@ $${TMPFILE} && mv $${TMPFILE} $@; fi
# You can set these variables from the command line.
SPHINXOPTS =
+2 -4
View File
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
TMPDIR=/tmp
TMPFILE=`mktemp`
echo "\documentclass{book}
@@ -10,5 +8,5 @@ echo "\documentclass{book}
\includepdf[width=${1},fitpaper]{${2}}
\end{document}" >${TMPFILE}.tex
pdflatex -output-directory /tmp ${TMPFILE}.tex >/dev/null 2>/dev/null
cp ${TMPFILE}.pdf ${2}
rm -f ${TMPFILE}{,.{tex,aux,log,pdf}}
cp ${TMPFILE}.pdf ${3}
+6 -6
View File
@@ -91,7 +91,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'ns3_html_theme'
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -99,14 +99,14 @@ html_theme = 'ns3_html_theme'
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['../..']
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = 'Model Library'
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = 'Models'
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
@@ -124,7 +124,7 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y %H:%M'
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
@@ -184,7 +184,7 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = '../../ns3_html_theme/static/ns-3.png'
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
+1 -1
View File
@@ -22,7 +22,6 @@ This document is written in `reStructuredText <http://docutils.sourceforge.net/r
aodv
applications
bridge
brite
buildings
click
csma
@@ -41,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
-85
View File
@@ -1,85 +0,0 @@
.. ns3-theme documentation master file, created by
sphinx-quickstart on Fri Jun 15 12:53:37 2012.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
The files in this directory customize the Doxygen and Sphinx
layout and rendering to give a common look.
Design
------
The basic color scheme is taken from the ns3 homepage, http://www.nsnam.org/
Since Sphinx provides more flexible layout and configuration control,
the Doxygen layout and images are used as the basis.
The top bar design is derived from Doxygen's default when a logo,
project name and description are given in the Doxygen configuration file.
The files ``layout.html`` and ``ns3_doxy_header.html`` should kept in sync.
Sphinx Files
------------
``layout.html`` (:ref:`static filename <sphinx-static-filenames>`)
Augments the default page layout, including the top bar.
``theme.conf`` (:ref:`static filename <sphinx-static-filenames>`)
Configuration parameters for ``layout.html`` and ``default.css_t``.
``static/bc_s.png``
Angle bracket in Sphinx relbar, taken from the Doxygen html output.
``static/default.css_t`` (:ref:`static filename <sphinx-static-filenames>`)
Default Sphinx CSS template, copied from the default theme.
``static/nav_f.png``
Background image for headings, taken from the Doxygen html output.
``static/sidebar.js`` (:ref:`static filename <sphinx-static-filenames>`)
Sidebar script, copied from the default theme.
``static/tab_b.png``
Background image for the Sphinx relbar, taken from the Doxygen html output.
.. _sphinx-static-filenames:
.. note:: **Static Filenames**
Sphinx uses hard-coded file names (and the ``static`` directory name).
The files referenced above can't be renamed.
Doxygen Files
-------------
``ns3_doxy_footer.html``
Defines the page footer.
``ns3_doxy_header.html``
Defines the page header, including the top bar.
``static/doxygen.css``
Default Doxygen CSS file, obtained by the ``doxygen -w html ...``
command.
Shared Files
------------
``README.rst``
This file, not used by Doxygen or Sphinx.
``static/bar-top.png``
Background image for the top bar, resized from the ns-3 homepage.
``static/favicon.ico``
Browser location bar favicon, referenced in ``layout.html`` and
``ns3_doxy_header.html``, taken from the ns-3 homepage.
``static/ns-3-inverted-notext-small.png``
Logo used in the top bar, taken from the ns-3 media kit.
``static/ns3_stylesheet.css``
Style customizations for both Doxygen and Sphinx.
-214
View File
@@ -1,214 +0,0 @@
#!/bin/bash
# Get the current repo name and version
# to format urls appropriately via Javascript
# variables for inclusion in html files.
# Use cases:
# 1. Hosted on nsnam.org, tagged release.
# 2. Hosted on nsnam.org, ns-3-dev.
# 3. User repo, modified from a tagged release (or ns-3-dev).
# 4. User repo, at a release tag.
# 5. User repo, at a private tag.
# 6. Private web host, at a tag (or ns-3-dev, or local mod).
#
# For case 1 and 2, we want the links to point to the nsnam.org
# publicly hosted pages. For all other cases, we want to point
# to the built pages in the repo itself.
#
# For robustness, we attempt to identify cases 1 & 2
# automatically. (There is also an explicit switch '-p'
# to force us into the public case.)
#
# The approach to identify cases 1 & 2 is to test:
# a. We're on nsnam.org (actually, nsnam.ece.gatech.edu), and
# b. We're in the tmp build directory, /tmp/daily-nsnam/
# (This is the directory used by the update-* scripts
# run by cron jobs.)
#
# If both a and b are true, we're building for public urls.
# (The newer update-docs script (through waf) sets
# NS3_WWW_URLS=public explicitly.)
#
# The repo version is either a tag name or a commit (short) id.
#
# If we're building for nsnam.org, and at a tag, we use just
# the tag as the repo name/version string, e.g. 'ns-3.14'.
# Otherwise, we're building for ns-3-dev, and we use, e.g,
# 'ns-3-dev @ fd0f27a10eff'.
#
# If we're *not* building for nsnam.org, we use the repo
# directory name as the repo name. (This will typically be
# a name meaningful to the user doing the build, perhaps a
# shorthand for the feature they are working on.) For
# example, this script was developed in a repo named
# 'docs'. We always use the repo version, resulting
# in document version strings like 'docs @ ns-3.15' or
# 'docs @ fd0f27a10eff'
#
me=`basename $0`
function say
{
echo "$me: $*"
}
function usage
{
cat <<-EOF
Usage: $me [-p] normal versioning
$me [-n] [-d] [-t] test options
-p build public urls, NS3_WWW_URLS=public is an alternative
Testing options:
-n pretend we are on nsnam.org
-d pretend we are in the automated build directory
-t pretend we are at a repo tag
EOF
exit 1
}
# script arguments
say
public=0
nsnam=0
daily=0
tag=0
while getopts :pndth option ; do
case $option in
(p) public=1 ;;
(n) nsnam=1 ;;
(d) daily=1 ;;
(t) tag=1 ;;
(h) usage ;;
(:) say "Missing argument to -$OPTARG" ; usage ;;
(\?) say "Invalid option: -$OPTARG" ; usage ;;
esac
done
# Hostname, fully qualified, e.g. nsnam.ece.gatech.edu
HOST=`hostname`
NSNAM="nsnam.ece.gatech.edu"
# Build directory
DAILY="^/tmp/daily-nsnam/"
if [ $nsnam -eq 1 ]; then
HOST=$NSNAM
say "-n forcing HOST = $HOST"
fi
if [ $daily -eq 1 ] ; then
OLDPWD=$PWD
PWD=/tmp/daily-nsnam/foo
say "-d forcing PWD = $PWD"
fi
if [ $tag -eq 1 ]; then
version="ns-3.14"
say "-t forcing tagged version = $version"
fi
if ((nsnam + daily + tag > 0)) ; then
say
fi
if [[ ($public == 1) || \
("${NS3_WWW_URLS:-}" == "public") || \
( ($HOST == $NSNAM) && ($PWD =~ $DAILY) ) ]] ; then
PUBLIC=1
say "building public docs for nsnam.org"
else
PUBLIC=0
say "building private docs"
fi
if [ $daily -eq 1 ]; then
PWD=$OLDPWD
fi
# Destination javascript file
outf="doc/ns3_html_theme/static/ns3_version.js"
# Distance from last tag
# Zero distance means we're at the tag
distance=`hg log -r tip --template '{latesttagdistance}'`
if [ $distance -eq 1 ]; then
version=`hg log -r tip --template '{latesttag}'`
say "at tag $version"
elif [ $tag -eq 1 ]; then
distance=1
# version previously set
vers_href=
else
version=`hg log -r tip --template '{node|short}'`
# Check for uncommitted changes
hg summary | grep -q 'commit: (clean)'
if [ ! $? ] ; then
say "beyond latest tag, last commit: $version, dirty"
dirty="(+)"
else
say "beyond latest tag, last commit: $version, clean"
dirty=
fi
fi
if [ $PUBLIC -eq 1 ]; then
echo "// ns3_version.js: automatically generated" > $outf
echo "// public urls" >> $outf
# Generate URL relative to server root
echo "var ns3_host = \"/\";" >> $outf
if [ $distance -eq 1 ]; then
# Like "http://www.nsnam.org/ns-3-14"
vers_href="http://www.nsnam.org/ns-3-${version#ns-3.}"
vers_href="<a href=\\\"$vers_href\\\">$version$dirty</a>"
echo "var ns3_version = \"Release $vers_href\";" >> $outf
echo "var ns3_release = \"docs/release/${version#ns-}/\";" >> $outf
else
# Like "http://code.nsnam.org/ns-3-dev/rev/<hash>"
vers_href="http://code.nsnam.org/ns-3-dev/rev/$version"
version="<a href=\\\"$vers_href\\\">$version$dirty</a>"
echo "var ns3_version = \"ns-3-dev @ $version\";" >> $outf
echo "var ns3_release = \"docs/\";" >> $outf
fi
echo "var ns3_local = \"\";" >> $outf
echo "var ns3_doxy = \"doxygen/\";" >> $outf
else
repo=`basename $PWD`
echo "// ns3_version.js: automatically generated" > $outf
echo "// private urls" >> $outf
echo "var ns3_host = \"file://$PWD/\";" > $outf
echo "var ns3_version = \"$repo @ $version$dirty\";" >> $outf
echo "var ns3_release = \"doc/\";" >> $outf
echo "var ns3_local = \"build/\";" >> $outf
echo "var ns3_doxy = \"html/\";" >> $outf
fi
# Copy to html directories
# This seems not always done automatically
# by Sphinx when rebuilding
cd doc 2>&1 >/dev/null
for d in {manual,models,tutorial{,-pt-br}}/build/{single,}html/_static/ ; do
# expect the copy to fail if the destination dir
# hasn't been created by a prior doc build
cp ns3_html_theme/static/ns3_version.js $d
done
cd - 2>&1 >/dev/null
# Show what was done
say
say "outf = $outf:"
cat -n $outf
say Done.
-121
View File
@@ -1,121 +0,0 @@
{#
ns-3/layout.html
~~~~~~~~~~~~~~~~~~~
Sphinx layout template for ns-3.
:copyright: Copyright 2012 by ns-3, see AUTHORS.
:license: GPL, see LICENSE for details.
#}
{% extends "basic/layout.html" %}
{% set reldelim1 = '<span class="navelem">&nbsp;</span>' %}
{# set reldelim1 = ' @' #}
{%- block extrahead %}
{%- if theme_customstylesheet %}
<link rel="stylesheet" type="text/css"
href="{{ pathto('_static/'+theme_customstylesheet, 1) }}" />
{%- endif %}
{%- if theme_favicon %}
<link rel="icon" type="image/ico"
href="{{ pathto('_static/'+theme_favicon, 1) }}" />
{%- endif %}
<script type="text/javascript" src="_static/drop-down-menu.js"></script>
<script type="text/javascript" src="_static/ns3_version.js"></script>
<script type="text/javascript">var ns3_builder="{{builder}}";</script>
<script type="text/javascript" src="_static/ns3_links.js"></script>
{% endblock %}
{% block header %}
<div id="titlearea">
<table cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo">
<a id="ns3_home1"
href="http://www.nsnam.org/">
<img alt="ns-3 Logo"
src="{{ pathto('_static/' + theme_logo, 1)}}"/>
</a>
</td>
<td id="projecttext">
<div id="projectbrief">A Discrete-Event Network Simulator</div>
<span id="projectnumber"><script type="text/javascript">document.write(ns3_version)</script></span>
</td>
<td id="ns3-menu">
<div class="menu">
<ul >
<li><a id="ns3_home2"
href="http://www.nsnam.org/"
>&nbsp;&nbsp;Home</a>
</li>
<li><span
onmouseover="mopen('mTuts')"
onmouseout="mclosetime()"
>Tutorials &nbsp;&#x25BC;</span>
<div id="mTuts"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a id="ns3_tut"
href="/docs/tutorial/html/index.html"
>English</a><br/>
<a id="ns3_ptbr"
href="/docs/tutorial-pt-br/html/index.html"
>Portuguese</a><br/>
</li>
<li><span
onmouseover="mopen('mDocs')"
onmouseout="mclosetime()"
>Docs &nbsp;&nbsp;&nbsp;&#x25BC;</span>
<div id="mDocs"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a id="ns3_wiki"
href="http://www.nsnam.org/wiki"
>Wiki</a><br/>
<a id="ns3_man"
href="/docs/manual/html/index.html"
>Manual</a><br/>
<a id="ns3_mod"
href="/docs/models/html/index.html"
>Models</a><br/>
</li>
<li><span
onmouseover="mopen('mDev')"
onmouseout="mclosetime()"
>Develop &#x25BC;</span>
<div id="mDev"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a id="ns3_api"
href="/docs/doxygen/html/index.html"
>API</a><br/>
<a id="ns3_bugs"
href="http://www.nsnam.org/bugzilla/">Bugs</a>
</li>
</ul>
</div>
</td>
<td id="projectsection">
<span style="margin-right:10px">{{ shorttitle }}</span>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">ns3_write_links()</script>
</div>
{% endblock %}
{% block rootrellink %}
<li class="navelem"><a href="{{ theme_homepage }}">{{ theme_projectname }}</a><span class="navelem">&nbsp;</span></li>
{{ super() }}
{% endblock %}
{% if theme_collapsiblesidebar|tobool %}
{% set script_files = script_files + ['_static/sidebar.js'] %}
{% endif %}
-20
View File
@@ -1,20 +0,0 @@
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small>
$generatedby &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath$doxygen.png" alt="doxygen"/>
</a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW-->
</body>
</html>
-105
View File
@@ -1,105 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"></meta>
<meta http-equiv="X-UA-Compatible" content="IE=9"></meta>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"></link>
<script type="text/javascript" src="$relpath$jquery.js"></script>
<script type="text/javascript" src="$relpath$dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css"></link>
<link href="$relpath$ns3_stylesheet.css" rel="stylesheet" type="text/css"></link>
<link href="$relpath$favicon.ico" rel="shortcut icon" type="image/ico"></link>
<script type="text/javascript" src="$relpath$drop-down-menu.js"></script>
<script type="text/javascript" src="$relpath$ns3_version.js"></script>
<script type="text/javascript" src="$relpath$ns3_links.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo">
<a id="ns3_home1"
href="http://www.nsnam.org/">
<img alt="ns-3 Logo"
src="$relpath$$projectlogo"/>
</a>
</td>
<td id="projecttext">
<div id="projectbrief">A Discrete-Event Network Simulator</div>
<span id="projectnumber"><script type="text/javascript">document.write(ns3_version)</script></span>
</td>
<td id="ns3-menu">
<div class="menu">
<ul >
<li><a id="ns3_home2"
href="http://www.nsnam.org/"
>&nbsp;&nbsp;Home</a>
</li>
<li><span
onmouseover="mopen('mTuts')"
onmouseout="mclosetime()"
>Tutorials &nbsp;&#x25BC;</span>
<div id="mTuts"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a id="ns3_tut"
href="/docs/tutorial/html/index.html"
>English</a><br/>
<a id="ns3_ptbr"
href="/docs/tutorial-pt-br/html/index.html"
>Portuguese</a><br/>
</li>
<li><span
onmouseover="mopen('mDocs')"
onmouseout="mclosetime()"
>Docs &nbsp;&nbsp;&nbsp;&#x25BC;</span>
<div id="mDocs"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a id="ns3_wiki"
href="http://www.nsnam.org/wiki"
>Wiki</a><br/>
<a id="ns3_man"
href="/docs/manual/html/index.html"
>Manual</a><br/>
<a id="ns3_mod"
href="/docs/models/html/index.html"
>Models</a><br/>
</li>
<li><span
onmouseover="mopen('mDev')"
onmouseout="mclosetime()"
>Develop &#x25BC;</span>
<div id="mDev"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a id="ns3_api"
href="/docs/doxygen/index.html"
>API</a><br/>
<a id="ns3_bugs"
href="http://www.nsnam.org/bugzilla/">Bugs</a>
</li>
</ul>
</div>
</td>
<td id="projectsection">
<span style="margin-right:10px">API</span>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">ns3_write_links()</script>
</div>
<!--END TITLEAREA-->
<!-- end header part -->
Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

-310
View File
@@ -1,310 +0,0 @@
/*
* default.css_t
* ~~~~~~~~~~~~~
*
* Sphinx stylesheet -- default theme.
*
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: {{ theme_bodyfont }};
font-size: 100%;
background-color: {{ theme_footerbgcolor }};
color: #000;
margin: 0;
padding: 0;
}
div.document {
background-color: {{ theme_sidebarbgcolor }};
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 {{ theme_sidebarwidth|toint }}px;
}
div.body {
background-color: {{ theme_bgcolor }};
color: {{ theme_textcolor }};
padding: 0 20px 30px 20px;
}
{%- if theme_rightsidebar|tobool %}
div.bodywrapper {
margin: 0 {{ theme_sidebarwidth|toint }}px 0 0;
}
{%- endif %}
div.footer {
color: {{ theme_footertextcolor }};
width: 100%;
padding: 9px 0 9px 0;
text-align: center;
font-size: 75%;
}
div.footer a {
color: {{ theme_footertextcolor }};
text-decoration: underline;
}
div.related {
background-color: {{ theme_relbarbgcolor }};
line-height: 30px;
color: {{ theme_relbartextcolor }};
}
div.related a {
color: {{ theme_relbarlinkcolor }};
}
div.sphinxsidebar {
{%- if theme_stickysidebar|tobool %}
top: 30px;
bottom: 0;
margin: 0;
position: fixed;
overflow: auto;
height: auto;
{%- endif %}
{%- if theme_rightsidebar|tobool %}
float: right;
{%- if theme_stickysidebar|tobool %}
right: 0;
{%- endif %}
{%- endif %}
}
{%- if theme_stickysidebar|tobool %}
/* this is nice, but it it leads to hidden headings when jumping
to an anchor */
/*
div.related {
position: fixed;
}
div.documentwrapper {
margin-top: 30px;
}
*/
{%- endif %}
div.sphinxsidebar h3 {
font-family: {{ theme_headfont }};
color: {{ theme_sidebartextcolor }};
font-size: 1.4em;
font-weight: normal;
margin: 0;
padding: 0;
}
div.sphinxsidebar h3 a {
color: {{ theme_sidebartextcolor }};
}
div.sphinxsidebar h4 {
font-family: {{ theme_headfont }};
color: {{ theme_sidebartextcolor }};
font-size: 1.3em;
font-weight: normal;
margin: 5px 0 0 0;
padding: 0;
}
div.sphinxsidebar p {
color: {{ theme_sidebartextcolor }};
}
div.sphinxsidebar p.topless {
margin: 5px 10px 10px 10px;
}
div.sphinxsidebar ul {
margin: 10px;
padding: 0;
color: {{ theme_sidebartextcolor }};
}
div.sphinxsidebar a {
color: {{ theme_sidebarlinkcolor }};
}
div.sphinxsidebar input {
border: 1px solid {{ theme_sidebarlinkcolor }};
font-family: sans-serif;
font-size: 1em;
}
{% if theme_collapsiblesidebar|tobool %}
/* for collapsible sidebar */
div#sidebarbutton {
background-color: {{ theme_sidebarbtncolor }};
}
{% endif %}
/* -- hyperlink styles ------------------------------------------------------ */
a {
color: {{ theme_linkcolor }};
text-decoration: none;
}
a:visited {
color: {{ theme_visitedlinkcolor }};
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
{% if theme_externalrefs|tobool %}
a.external {
text-decoration: none;
border-bottom: 1px dashed {{ theme_linkcolor }};
}
a.external:hover {
text-decoration: none;
border-bottom: none;
}
a.external:visited {
text-decoration: none;
border-bottom: 1px dashed {{ theme_visitedlinkcolor }};
}
{% endif %}
/* -- body styles ----------------------------------------------------------- */
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: {{ theme_headfont }};
background-color: {{ theme_headbgcolor }};
font-weight: normal;
color: {{ theme_headtextcolor }};
border-bottom: 1px solid #ccc;
margin: 20px -20px 10px -20px;
padding: 3px 0 3px 10px;
}
div.body h1 { margin-top: 0; font-size: 200%; }
div.body h2 { font-size: 160%; }
div.body h3 { font-size: 140%; }
div.body h4 { font-size: 120%; }
div.body h5 { font-size: 110%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: {{ theme_headlinkcolor }};
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
a.headerlink:hover {
background-color: {{ theme_headlinkcolor }};
color: white;
}
div.body p, div.body dd, div.body li {
text-align: justify;
line-height: 130%;
}
div.admonition p.admonition-title + p {
display: inline;
}
div.admonition p {
margin-bottom: 5px;
}
div.admonition pre {
margin-bottom: 5px;
}
div.admonition ul, div.admonition ol {
margin-bottom: 5px;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre {
padding: 5px;
background-color: {{ theme_codebgcolor }};
color: {{ theme_codetextcolor }};
line-height: 120%;
border: 1px solid #ac9;
border-left: none;
border-right: none;
}
tt {
background-color: #ecf0f3;
padding: 0 1px 0 1px;
font-size: 0.95em;
}
th {
background-color: #ede;
}
.warning tt {
background: #efc2c2;
}
.note tt {
background: #d6d6d6;
}
.viewcode-back {
font-family: {{ theme_bodyfont }};
}
div.viewcode-block:target {
background-color: #f4debf;
border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9;
}
File diff suppressed because it is too large. Load diff
@@ -1,45 +0,0 @@
// Copyright 2006-2007 javascript-array.com
// http://javascript-array.com/scripts/simple_drop_down_menu/
var timeout = 250;
var closetimer = 0;
var ddmenuitem = 0;
// open hidden layer
function mopen(id)
{
// cancel close timer
mcancelclosetime();
// close old layer
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
// get new layer and show it
ddmenuitem = document.getElementById(id);
ddmenuitem.style.visibility = 'visible';
}
// close showed layer
function mclose()
{
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
// go close timer
function mclosetime()
{
closetimer = window.setTimeout(mclose, timeout);
}
// cancel close timer
function mcancelclosetime()
{
if(closetimer)
{
window.clearTimeout(closetimer);
closetimer = null;
}
}
// close layer when click-out
document.onclick = mclose;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

-58
View File
@@ -1,58 +0,0 @@
// nsnam.org links, independent of version
var ns3_site = "http://www.nsnam.org/";
var ns3_home = ns3_site + "";
var ns3_wiki = ns3_site + "wiki";
var ns3_bugs = ns3_site + "bugzilla";
// Links that depend on version:
// Defined in ns3_version.js:
// ns3_host = "//" file://$PWD
// ns3_version = "3.14" "3.14
// = "ns-3-dev @ 12345abcde "repo @ 12345abcde
// ns3_release = "docs/release/3.14/" "repo/"
// ns3_local = "" "build/"
//
// This lets us build several kinds of links:
// http://www.nsnam.org/docs/manual/html/index.html
// http://www.nsnam.org/docs/release/3.14/manual/html/index.html
// file:///.../doc/manual/build/html/index.html
//
// with the appropriate version string.
var ns3_index = "index.html";
var ns3_rel = ns3_host + ns3_release;
var ns3_api = ns3_rel + ns3_doxy + ns3_index;
// The Sphinx layout template defines
// var ns3_builder = "html", or "singlehtml"
// so we can condition the links on single/multi-page view.
if (typeof ns3_builder != 'undefined') {
if (ns3_builder == "singlehtml") {
ns3_index = ns3_local + "singlehtml/" + ns3_index;
} else {
ns3_index = ns3_local + "html/" + ns3_index;
}
}
else {
ns3_index = ns3_local + "html/" + ns3_index;
}
var ns3_man = ns3_rel + "manual/" + ns3_index;
var ns3_mod = ns3_rel + "models/" + ns3_index;
var ns3_tut = ns3_rel + "tutorial/" + ns3_index;
var ns3_ptbr = ns3_rel + "tutorial-pt-br/" + ns3_index;
function ns3_write_links() {
document.getElementById("ns3_home1").href = ns3_home;
document.getElementById("ns3_home2").href = ns3_home;
document.getElementById("ns3_wiki" ).href = ns3_wiki;
document.getElementById("ns3_bugs" ).href = ns3_bugs;
document.getElementById("ns3_api" ).href = ns3_api;
document.getElementById("ns3_man" ).href = ns3_man;
document.getElementById("ns3_mod" ).href = ns3_mod;
document.getElementById("ns3_tut" ).href = ns3_tut;
document.getElementById("ns3_ptbr" ).href = ns3_ptbr;
}
@@ -1,210 +0,0 @@
/* ns-3 changes to the default CSS from Doxygen and Sphinx */
body,
table,
div,
p,
dl {
color: black;
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
font-size: 12px;
}
a {
color: #91A501;
font-weight: bold;
}
/* Sphinx headings */
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
background-image: url('nav_f.png');
}
/* Doxygen side bar */
#nav-tree {
font-size: 12px;
}
#nav-tree a {
font-weight: normal;
}
/* Sphinx nav links bar (relbar) */
div.related {
background-image:url('tab_b.png')
}
div.related h3 {
display: none;
}
div.related a {
color: #91A501;
font-size: 14px;
font-weight: bold;
}
div.related li {
background-image: url('bc_s.png');
background-position: 100% 40%;
background-repeat: no-repeat;
padding-left: 10px;
padding-right: 15px;
}
div.related li.right {
background-image: none;
padding-left: 0px;
padding-right: 0px;
}
/* Sphinx side bar */
div.sphinxsidebar {
font-size: 12px;
}
div.sphinxsidebar a {
font-weight: normal;
}
/* Title bar elements */
#titlearea {
background-image:url('bar-top.png');
background-repeat:repeat;
border-bottom: 1px solid #5B5B5B;
color: white;
}
#projectlogo {
color: white;
margin: 10px;
text-align: center;
vertical-align: middle;
width: 220px;
}
#projecttext {
align: left;
font-color:white;
padding-left: 2em;
width: 250px;
}
#projectbrief {
color: white;
font: 120% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 0px;
}
#projectnumber {
color: white;
font: 100% Tahoma, Arial,sans-serif;
margin: 0px;
padding: 0px;
}
#projectsection {
color: white;
font: 24pt Aldo, Tahoma, Arial,sans-serif;
margin-right: 10px;
margin: 10px;
text-align: right;
vertical-align: middle;
}
/*
ns-3 Main-menu, based on WordPress site
Drop down menu based on Simple Javascript Drop-Down Menu v2.0
http://javascript-array.com/scripts/simple_drop_down_menu/
*/
#ns3-menu .menu {
background-image: url('menu-bgr-400.png');
/* background-origin: padding-box; */
/* background-position: -10px 0; */
background-repeat: no-repeat;
display: table-cell;
float:left;
height: 40px;
margin: 0px 0px 0px 0px;
overflow: hidden;
padding:0px 0px 0px 0px;
vertical-align: middle;
width: 450px;
}
#ns3-menu .menu ul {
/* float:left; */
height: 40;
list-style:none;
margin:0px 0px 0px -2px;
/* overflow:hidden; */
padding:0px 0px 0px 0px;
z-index: 30;
}
#ns3-menu .menu ul li {
background-image: url('ver.png');
background-origin: padding-box;
background-position: 0 11px;
background-repeat: no-repeat;
color:#ffffff;
float:left;
font-family: Aldo, Tahoma, Arial, sans-serif;
font-size: 14px;
/* height:40px; */
margin:0px 0px 0px 0px;
/* overflow:hidden; */
padding:11px 13px 0px 12px;
text-transform:uppercase;
}
#ns3-menu .menu ul li a {
color:#ffffff;
/* cursor: pointer; */
display:block;
float:left;
font-weight: normal; /* default anchors are bold */
text-decoration:none; /* default anchors are underlined */
}
#ns3-menu .menu ul li a:hover {
color:#cadc48;
text-decoration:none; /* don't add underline on hover */
}
#ns3-menu .menu div {
background: #94A901;
background-size: 100%; 100%
color:#ffffff;
position: absolute;
visibility: hidden;
}
#ns3-menu .menu div a {
position: relative;
display: block;
float: left;
font-family: Aldo, Tahoma, Arial, sans-serif;
font-size: 14px;
margin: 0;
padding: 5px 10px;
text-align: left;
width: auto;
white-space: nowrap;
}
#ns3-menu .menu div a:hover {
color:#cadc48;
text-decoration:none; /* don't add underline on hover */
}
-151
View File
@@ -1,151 +0,0 @@
/*
* sidebar.js
* ~~~~~~~~~~
*
* This script makes the Sphinx sidebar collapsible.
*
* .sphinxsidebar contains .sphinxsidebarwrapper. This script adds
* in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton
* used to collapse and expand the sidebar.
*
* When the sidebar is collapsed the .sphinxsidebarwrapper is hidden
* and the width of the sidebar and the margin-left of the document
* are decreased. When the sidebar is expanded the opposite happens.
* This script saves a per-browser/per-session cookie used to
* remember the position of the sidebar among the pages.
* Once the browser is closed the cookie is deleted and the position
* reset to the default (expanded).
*
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
$(function() {
// global elements used by the functions.
// the 'sidebarbutton' element is defined as global after its
// creation, in the add_sidebar_button function
var bodywrapper = $('.bodywrapper');
var sidebar = $('.sphinxsidebar');
var sidebarwrapper = $('.sphinxsidebarwrapper');
// for some reason, the document has no sidebar; do not run into errors
if (!sidebar.length) return;
// original margin-left of the bodywrapper and width of the sidebar
// with the sidebar expanded
var bw_margin_expanded = bodywrapper.css('margin-left');
var ssb_width_expanded = sidebar.width();
// margin-left of the bodywrapper and width of the sidebar
// with the sidebar collapsed
var bw_margin_collapsed = '.8em';
var ssb_width_collapsed = '.8em';
// colors used by the current theme
var dark_color = $('.related').css('background-color');
var light_color = $('.document').css('background-color');
function sidebar_is_collapsed() {
return sidebarwrapper.is(':not(:visible)');
}
function toggle_sidebar() {
if (sidebar_is_collapsed())
expand_sidebar();
else
collapse_sidebar();
}
function collapse_sidebar() {
sidebarwrapper.hide();
sidebar.css('width', ssb_width_collapsed);
bodywrapper.css('margin-left', bw_margin_collapsed);
sidebarbutton.css({
'margin-left': '0',
'height': bodywrapper.height()
});
sidebarbutton.find('span').text('»');
sidebarbutton.attr('title', _('Expand sidebar'));
document.cookie = 'sidebar=collapsed';
}
function expand_sidebar() {
bodywrapper.css('margin-left', bw_margin_expanded);
sidebar.css('width', ssb_width_expanded);
sidebarwrapper.show();
sidebarbutton.css({
'margin-left': ssb_width_expanded-12,
'height': bodywrapper.height()
});
sidebarbutton.find('span').text('«');
sidebarbutton.attr('title', _('Collapse sidebar'));
document.cookie = 'sidebar=expanded';
}
function add_sidebar_button() {
sidebarwrapper.css({
'float': 'left',
'margin-right': '0',
'width': ssb_width_expanded - 28
});
// create the button
sidebar.append(
'<div id="sidebarbutton"><span>&laquo;</span></div>'
);
var sidebarbutton = $('#sidebarbutton');
light_color = sidebarbutton.css('background-color');
// find the height of the viewport to center the '<<' in the page
var viewport_height;
if (window.innerHeight)
viewport_height = window.innerHeight;
else
viewport_height = $(window).height();
sidebarbutton.find('span').css({
'display': 'block',
'margin-top': (viewport_height - sidebar.position().top - 20) / 2
});
sidebarbutton.click(toggle_sidebar);
sidebarbutton.attr('title', _('Collapse sidebar'));
sidebarbutton.css({
'color': '#FFFFFF',
'border-left': '1px solid ' + dark_color,
'font-size': '1.2em',
'cursor': 'pointer',
'height': bodywrapper.height(),
'padding-top': '1px',
'margin-left': ssb_width_expanded - 12
});
sidebarbutton.hover(
function () {
$(this).css('background-color', dark_color);
},
function () {
$(this).css('background-color', light_color);
}
);
}
function set_position_from_cookie() {
if (!document.cookie)
return;
var items = document.cookie.split(';');
for(var k=0; k<items.length; k++) {
var key_val = items[k].split('=');
var key = key_val[0];
if (key == 'sidebar') {
var value = key_val[1];
if ((value == 'collapsed') && (!sidebar_is_collapsed()))
collapse_sidebar();
else if ((value == 'expanded') && (sidebar_is_collapsed()))
expand_sidebar();
}
}
}
add_sidebar_button();
var sidebarbutton = $('#sidebarbutton');
set_position_from_cookie();
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 B

-50
View File
@@ -1,50 +0,0 @@
[theme]
inherit = basic
stylesheet = default.css
pygments_style = sphinx
[options]
projectname = ns-3
homepage =
customstylesheet = ns3_stylesheet.css
logo = ns-3-inverted-notext-small.png
logoalt = ns-3 Logo
last_updated_fmt = '%%b %%d, %%Y'
favicon = favicon.ico
docstitle = Documentation
rightsidebar = false
stickysidebar = false
collapsiblesidebar = false
externalrefs = false
bgcolor = white
textcolor = black
linkcolor = #91A501
visitedlinkcolor = #91A501
headbgcolor = #E3E3E3
headtextcolor = #373737
headlinkcolor = #91A501
relbarbgcolor = #D5D5D5
relbarlinkcolor = #373737
relbartextcolor = #373737
sidebarbgcolor = #FAFAFA
sidebartextcolor = #373737
sidebarlinkcolor = #91A501
sidebarbtncolor = #D5D5D5
footerbgcolor = #D5D5D5
footertextcolor = #364D7C
codebgcolor = ##FBFCFD
codetextcolor = black
bodyfont = 'Lucida Grande', Verdana, Geneva, Arial, sans-serif
headfont = 'Lucida Grande', Verdana, Geneva, Arial, sans-serif
+79 -93
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
- confirm that Doxygen builds cleanly (./waf doxygen),
- confirm all documents build: './waf docs' and check outputs
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.rc1.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
@@ -140,7 +145,9 @@ preparing the documentation
1. If final release, build release documentation
- sudo bash; su nsnam; cd /home/nsnam/bin
./update-docs -r http://code.nsnam.org/ns-3.x -R
./update-doxygen-release ns-3.x
./update-manual-release ns-3.x
./update-tutorial-release ns-3.x
2. Check if these new files are available on the website
@@ -164,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
---------------
@@ -191,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/
+7 -7
View File
@@ -56,7 +56,7 @@ release = 'ns-3-dev'
# The language for content autogenerated by . Refer to babel documentation
# for a list of supported languages.
language = 'pt_BR'
language = 'pt-br'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
@@ -93,7 +93,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'ns3_html_theme'
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -101,11 +101,11 @@ html_theme = 'ns3_html_theme'
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['../..']
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = 'Rastreamento'
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
@@ -126,7 +126,7 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y %H:%M'
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
@@ -180,13 +180,13 @@ htmlhelp_basename = 'ns-3doc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'ns-3-tutorial.tex', u'ns-3 Rastreamento',
('index', 'ns-3-tutorial.tex', u'ns-3 Tutorial',
u'ns-3 project', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = '../../ns3_html_theme/static/ns-3.png'
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
+1 -1
View File
@@ -18,7 +18,7 @@ ns-3 Tutorial
This is the *ns-3 Tutorial*. Primary documentation for the ns-3 project is
available in five forms:
Este é o *Tutorial do ns-3* baseado no *ns-3 Tutorial* (inglês), versão 3.14. A documentação para o projeto ns-3 esta disponível da seguinte forma:
Este é o *Tutorial do ns-3* baseado no *ns-3 Tutorial* (inglês). A documentação para o projeto ns-3 esta disponível da seguinte forma:
..
* `ns-3 Doxygen <http://www.nsnam.org/doxygen/index.html>`_: Documentation of the public APIs of the simulator
+1 -1
View File
@@ -57,7 +57,7 @@ Alguns pontos importantes para se observar:
project will continue to maintain ns-2 while |ns3| is being built,
and will study transition and integration mechanisms.
* O |ns3| não é uma extensão do ns-2; O |ns3| é um simulador novo. Ambos são escritos em C++, mas o |ns3| é totalmente novo e não suporta as APIs da versão anterior. Algumas funcionalidades do ns-2 já foram portadas para o |ns3|. O projeto continuará mantendo o ns-2 enquanto o |ns3| estiver em fase de desenvolvimento e formas de integração e transição estão em estudo.
* O |ns3| não é uma extensão do `ns-2 <http://www.isi.edu/nsnam/ns>`_; O |ns3| é um simulador novo. Ambos são escritos em C++, mas o |ns3| é totalmente novo e não suporta as APIs da versão anterior. Algumas funcionalidades do ns-2 já foram portadas para o |ns3|. O projeto continuará mantendo o ns-2 enquanto o |ns3| estiver em fase de desenvolvimento e formas de integração e transição estão em estudo.
..
* |ns3| is open-source, and the project strives to maintain an
+2 -12
View File
@@ -148,7 +148,7 @@ do |ns3|, al
there is no log message for the no ack case. You could simply add one,
changing the code from:
Vamos analisar um exemplo, adicionando mais informações de registro ao `socket` TCP do arquivo ``tcp-socket-base.cc``, para isto vamos acrescentando uma nova mensagem de registro na implementação. Observe que em ``TcpSocketBase::ReceivedAck()`` não existem mensagem de registro para casos sem o ACK, então vamos adicionar uma da seguinte forma:
Vamos analisar um exemplo, adicionando mais informações de registro ao `socket` TCP do arquivo ``tcp-socket-base.cc``, para isto vamos acrescentando uma nova mensagem de registro na implementação. Observe que em ``TcpSocketBase::ReceivedAck()`` não existem mensagem de registro para casos sem o *ACK*, então vamos adicionar uma da seguinte forma:
::
@@ -2491,17 +2491,7 @@ no in
interesting behaviors of the congestion window.
Nas próximas linhas, temos um código com algumas informações novas. Se nós
rastrearmos uma conexão que comporta-se perfeitamente, terminamos com um
janela de congestionamento que aumenta monoliticamente. Para observarmos um
comportamento interessante, introduzimos erros que causarão perda de pacotes,
duplicação de ACK's e assim, introduz comportamentos mais interessantes a
janela de congestionamento.
Nas próximas linhas, temos um código com algumas informações novas. Se nós rastrearmos uma conexão que comporta-se perfeitamente, terminamos com um janela de congestionamento que aumenta monoliticamente. Para observarmos um comportamento interessante, introduzimos erros que causarão perda de pacotes, duplicação de `ACK`s e assim, introduz comportamentos mais interessantes a janela de congestionamento.
..
+2 -2
View File
@@ -267,7 +267,7 @@ leftmost point-to-point node seen in the topology illustration.
UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (p2pNodes.Get (0));
@@ -1124,7 +1124,7 @@ the server on the CSMA network. We have also seen similar operations before.
UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps =
+2 -2
View File
@@ -313,7 +313,7 @@ section, so go ahead and expand that documentation node. Now, expand the
``Debugging`` book and then select the ``Logging`` page.
You should now be looking at the Doxygen documentation for the Logging module.
In the list of ``#define``'s at the top of the page you will see the entry
In the list of ``#define``s at the top of the page you will see the entry
for ``NS_LOG_COMPONENT_DEFINE``. Before jumping in, it would probably be
good to look for the "Detailed Description" of the logging module to get a
feel for the overall operation. You can either scroll down or select the
@@ -636,7 +636,7 @@ that is managed by an ``UdpEchoClientHelper``.
UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
+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
+5 -5
View File
@@ -91,7 +91,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'ns3_html_theme'
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@@ -99,11 +99,11 @@ html_theme = 'ns3_html_theme'
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['../..']
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = 'Tutorial'
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
@@ -124,7 +124,7 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y %H:%M'
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
@@ -184,7 +184,7 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = '../../ns3_html_theme/static/ns-3.png'
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
+3 -42
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.
@@ -53,7 +53,6 @@ that approach, you can get a copy of ``ns-3-allinone`` by typing the
following into your Linux shell (assuming you have installed Mercurial):
::
cd
mkdir repos
cd repos
@@ -221,7 +220,7 @@ have to pick a release, download it and decompress it.
As mentioned above, one practice is to create a directory called ``repos``
in one's home directory under which one can keep local Mercurial repositories.
One could also keep a ``tarballs`` directory. *Hint: the tutorial
will assume you downloaded into a* ``repos`` *directory, so remember the
will assume you downloaded into a ``repos`` directory, so remember the
placekeeper.* If you adopt the ``tarballs`` directory approach, you can
get a copy of a release by typing the following into your Linux shell
(substitute the appropriate version numbers, of course):
@@ -299,22 +298,6 @@ following magic words:
topology-read uan virtual-net-device
visualizer wifi wimax
Waf: Leaving directory `/home/craigdo/repos/ns-3-allinone/ns-3.13/build'
'build' finished successfully (2m30.586s)
You may also see something like:
::
Modules not built (see ns-3 tutorial for explanation):
click openflow visualizer
This just means that some ns-3 modules that have dependencies on
outside libraries may not have been built, or that the configuration
specifically asked not to build them. It does not mean that the
simulator did not build successfully or that it will provide wrong
results for the modules listed as being built.
Once the project has built, you can stop working with the
``ns-3-allinone`` scripts. You got what you needed from them and will now
interact directly with Waf and we do it in the |ns3| directory,
@@ -471,28 +454,6 @@ the ``-o`` option to configure; e.g.
This allows users to work with multiple builds rather than always
overwriting the last build.
In the examples above, waf uses GCC C++ compiler, command ``g++``, for
building ns-3. However, it's possible to change C++ compiler used by waf.
Say one wants to use Clang C++ compiler, command ``clang++``; it's done by
::
CXX="clang++" ./waf configure
./waf build
One can also set up waf to do distributed compilation with ``distcc`` in
a similar way:
::
CXX="distcc g++" ./waf configure
./waf build
More info on distcc and distributed compilation can be found on it's
`project page
<http://code.google.com/p/distcc/>`_
under Documentation section.
Testing ns-3
************
@@ -580,7 +541,7 @@ produces the following output.
*What do I do if I don't see the output?*
If you see ``waf`` messages indicating that the build was
If you don't see ``waf`` messages indicating that the build was
completed successfully, but do not see the "Hello Simulator" output,
chances are that you have switched your build mode to "optimized" in
the "Building with Waf" section, but have missed the change back to
+12 -7
View File
@@ -85,7 +85,7 @@ potentially be useful to other people as a patch to the existing core.
Let's pick a random example. If you wanted to add more logging to the
|ns3| TCP socket (``tcp-socket-base.cc``) you could just add a new
message down in the implementation. Notice that in TcpSocketBase::ReceivedAck()
there is no log message for the no ACK case. You could simply add one,
there is no log message for the no ack case. You could simply add one,
changing the code from:
::
@@ -1298,7 +1298,7 @@ when the ``main`` function of your script is running, but before
executing the simulation, ``Simulator::Run`` will return control back to
the ``main`` function. When this happens, the script enters what can be
called "Teardown Time," which is when the structures and objects created
during setup are taken apart and released.
during setup and taken apart and released.
Perhaps the most common mistake made in trying to use the tracing system is
assuming that entities constructed dynamically during simulation time are
@@ -1816,12 +1816,17 @@ to introduce errors into a ``Channel`` at a given *rate*.
::
Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ();
em->SetAttribute ("ErrorRate", DoubleValue (0.00001));
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> (
"RanVar", RandomVariableValue (UniformVariable (0., 1.)),
"ErrorRate", DoubleValue (0.00001));
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
The above code instantiates a ``RateErrorModel`` Object, and
we set the "ErrorRate" ``Attribute`` to the desired value.
The above code instantiates a ``RateErrorModel`` Object. Rather than
using the two-step process of instantiating it and then setting Attributes,
we use the convenience function ``CreateObjectWithAttributes`` which
allows us to do both at the same time. We set the "RanVar"
``Attribute`` to a random variable that generates a uniform distribution
from 0 to 1. We also set the "ErrorRate" ``Attribute``.
We then set the resulting instantiated ``RateErrorModel`` as the error
model used by the point-to-point ``NetDevice``. This will give us some
retransmissions and make our plot a little more interesting.
@@ -2342,7 +2347,7 @@ must implement a single virtual method inherited from this class.
The signature of this method reflects the device-centric view of the situation
at this level. All of the public methods inherited from class
``PcapUserHelperForDevice`` reduce to calling this single device-dependent
2``PcapUserHelperForDevice`` reduce to calling this single device-dependent
implementation method. For example, the lowest level pcap method,
::
+13 -29
View File
@@ -37,32 +37,18 @@ easily get a quick message out of your scripts or models.
There are currently seven levels of log messages of increasing verbosity
defined in the system.
* LOG_ERROR --- Log error messages (associated macro: NS_LOG_ERROR);
* LOG_WARN --- Log warning messages (associated macro: NS_LOG_WARN);
* LOG_DEBUG --- Log relatively rare, ad-hoc debugging messages
(associated macro: NS_LOG_DEBUG);
* LOG_INFO --- Log informational messages about program progress
(associated macro: NS_LOG_INFO);
* LOG_FUNCTION --- Log a message describing each function called
(two associated macros: NS_LOG_FUNCTION, used for member functions,
and NS_LOG_FUNCTION_NOARGS, used for static functions);
* LOG_LOGIC -- Log messages describing logical flow within a function
(associated macro: NS_LOG_LOGIC);
* LOG_ALL --- Log everything mentioned above (no associated macro).
* NS_LOG_ERROR --- Log error messages;
* NS_LOG_WARN --- Log warning messages;
* NS_LOG_DEBUG --- Log relatively rare, ad-hoc debugging messages;
* NS_LOG_INFO --- Log informational messages about program progress;
* NS_LOG_FUNCTION --- Log a message describing each function called;
* NS_LOG_LOGIC -- Log messages describing logical flow within a function;
* NS_LOG_ALL --- Log everything.
For each LOG_TYPE there is also LOG_LEVEL_TYPE that, if used, enables
logging of all the levels above it in addition to it's level. (As a
consequence of this, LOG_ERROR and LOG_LEVEL_ERROR and also LOG_ALL
and LOG_LEVEL_ALL are functionally equivalent.) For example,
enabling LOG_INFO will only enable messages provided by NS_LOG_INFO macro,
while enabling LOG_LEVEL_INFO will also enable messages provided by
NS_LOG_DEBUG, NS_LOG_WARN and NS_LOG_ERROR macros.
We also provide an unconditional logging macro that is always displayed,
We also provide an unconditional logging level that is always displayed,
irrespective of logging levels or component selection.
* NS_LOG_UNCOND -- Log the associated message unconditionally (no associated
log level).
* NS_LOG_UNCOND -- Log the associated message unconditionally.
Each level can be requested singly or cumulatively; and logging can be set
up using a shell environment variable (NS_LOG) or by logging system function
@@ -157,12 +143,10 @@ system will pick up the change and you should see the following output:
The additional debug information provided by the application is from
the NS_LOG_FUNCTION level. This shows every time a function in the application
is called during script execution. Generally, use of (at least)
NS_LOG_FUNCTION(this) in member functions is preferred. Use
NS_LOG_FUNCTION_NOARGS() only in static functions. Note, however, that there
are no requirements in the |ns3| system that models must support any particular
logging functionality. The decision regarding how much information is logged
is left to the individual model developer. In the case of the echo
is called during script execution. Note that there are no requirements in the
|ns3| system that models must support any particular logging
functionality. The decision regarding how much information is logged
is left to the individual model developer. In the case of the echo
applications, a good deal of log output is available.
You can now see a log of the function calls that were made to the application.
+5 -3
View File
@@ -116,7 +116,9 @@ main (int argc, char *argv[])
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (i3i2.GetAddress (1), port)));
onoff.SetConstantRate (DataRate ("448kb/s"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (c.Get (0));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
@@ -147,8 +149,8 @@ main (int argc, char *argv[])
//
// Create an ErrorModel based on the implementation (constructor)
// specified by the default classId
Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ();
em->SetAttribute ("ErrorRate", DoubleValue (0.001));
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> ("RanVar", RandomVariableValue (UniformVariable (0.0, 1.0)),
"ErrorRate", DoubleValue (0.001));
d3d2.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
// Now, let's use the ListErrorModel and explicitly force a loss
+4 -5
View File
@@ -243,16 +243,15 @@ int main (int argc, char *argv[])
// same time. This rn is added to AppStartTime to have the sources
// start at different time, however they will still send at the same rate.
Ptr<UniformRandomVariable> x = CreateObject<UniformRandomVariable> ();
x->SetAttribute ("Min", DoubleValue (0));
x->SetAttribute ("Max", DoubleValue (1));
double rn = x->GetValue ();
UniformVariable x (0,1);
double rn = x.GetValue ();
Ptr<Node> n = nodes.Get (j);
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
Ipv4InterfaceAddress ipv4_int_addr = ipv4->GetAddress (1, 0);
Ipv4Address ip_addr = ipv4_int_addr.GetLocal ();
OnOffHelper onoff ("ns3::UdpSocketFactory", InetSocketAddress (ip_addr, port)); // traffic flows from node[i] to node[j]
onoff.SetConstantRate (DataRate (AppPacketRate));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (nodes.Get (i)); // traffic sources are installed on all nodes
apps.Start (Seconds (AppStartTime + rn));
apps.Stop (Seconds (AppStopTime));
@@ -19,16 +19,18 @@
* Author: Martín Giachino <martin.giachino@gmail.com>
*
*
* This example demonstrates the use of Ns2MobilityHelper class to work with mobility.
* This example demonstrates the use of Ns2TransmobilityHelper class to work with mobility.
*
* Detailed example description.
*
* - intended usage: this should be used in order to load ns2 movement trace files into ns3.
* - behavior:
* - Ns2MobilityHelper object is created, associated to the specified trace file.
* - Ns2TransmobilityHelperTrace object is created, whith the specified trace file. At this moment, only
* specify the file, and no movements are scheduled.
* - A log file is created, using the log file name argument.
* - A node container is created with the number of nodes specified in the command line. For the default ns-2 trace, specify the value 2 for this argument.
* - the program calls the Install() method of Ns2MobilityHelper to set mobility to nodes. At this moment, the file is read line by line, and the movement is scheduled in the simulator.
* - A node container is created with the correct node number specified in the command line.
* - Use Install method of Ns2TransmobilityHelperTrace to set mobility to nodes. At this moment, file is
* read line by line, and the movement is scheduled in the simulator.
* - A callback is configured, so each time a node changes its course a log message is printed.
* - expected output: example prints out messages generated by each read line from the ns2 movement trace file.
* For each line, it shows if the line is correct, or of it has errors and in this case it will
@@ -36,15 +38,15 @@
*
* Usage of ns2-mobility-trace:
*
* ./waf --run "ns2-mobility-trace \
* --traceFile=src/mobility/examples/default.ns_movements
* --nodeNum=2 --duration=100.0 --logFile=ns2-mobility-trace.log"
* ./waf --run "examples/mobility/ns2-mobility-trace \
* --traceFile=/home/mgiachino/ns-3-dev/examples/mobility/default.ns_movements
* --nodeNum=2 --duration=100.0 --logFile=ns2-mobility-trace.log"
*
* NOTE: ns2-traces-file could be an absolute or relative path. You could use the file default.ns_movements
* included in the same directory as the example file.
* NOTE 2: Number of nodes present in the trace file must match with the command line argument.
* Note that you must know it before to be able to load it.
* NOTE 3: Duration must be a positive number and should match the trace file. Note that you must know it before to be able to load it.
* NOTE: ns2-traces-file could be an absolute or relative path. You could use the file default.ns_movements
* included in the same directory that the present file.
* NOTE 2: Number of nodes present in the trace file must match with the command line argument.
* Note that you must know it before to be able to load it.
* NOTE 3: Duration must be a positive number. Note that you must know it before to be able to load it.
*/
@@ -97,10 +99,10 @@ int main (int argc, char *argv[])
{
std::cout << "Usage of " << argv[0] << " :\n\n"
"./waf --run \"ns2-mobility-trace"
" --traceFile=src/mobility/examples/default.ns_movements"
" --nodeNum=2 --duration=100.0 --logFile=ns2-mob.log\" \n\n"
" --traceFile=/home/mgiachino/ns-3-dev/examples/mobility/default.ns_movements"
" --nodeNum=2 --duration=100.0 --logFile=main-ns2-mob.log\" \n\n"
"NOTE: ns2-traces-file could be an absolute or relative path. You could use the file default.ns_movements\n"
" included in the same directory of this example file.\n\n"
" included in the same directory that the present file.\n\n"
"NOTE 2: Number of nodes present in the trace file must match with the command line argument and must\n"
" be a positive number. Note that you must know it before to be able to load it.\n\n"
"NOTE 3: Duration must be a positive number. Note that you must know it before to be able to load it.\n\n";
@@ -115,6 +117,8 @@ int main (int argc, char *argv[])
std::ofstream os;
os.open (logFile.c_str ());
// Create all nodes.
NodeContainer stas;
stas.Create (nodeNum);
+1
View File
@@ -0,0 +1 @@
exec "`dirname "$0"`"/../../waf "$@"
+6
View File
@@ -0,0 +1,6 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
obj = bld.create_ns3_program('ns2-mobility-trace', ['internet', 'mobility', 'wifi', 'mesh', 'applications'])
obj.source = 'ns2-mobility-trace.cc'
+5 -3
View File
@@ -151,7 +151,9 @@ main (int argc, char *argv[])
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
InetSocketAddress (i5i6.GetAddress (1), port));
onoff.SetConstantRate (DataRate ("2kbps"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", StringValue ("2kbps"));
onoff.SetAttribute ("PacketSize", UintegerValue (50));
ApplicationContainer apps = onoff.Install (c.Get (1));
@@ -162,8 +164,8 @@ main (int argc, char *argv[])
// 210 bytes at a rate of 448 Kb/s
OnOffHelper onoff2 ("ns3::UdpSocketFactory",
InetSocketAddress (i1i6.GetAddress (1), port));
onoff2.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
onoff2.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
onoff2.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff2.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff2.SetAttribute ("DataRate", StringValue ("2kbps"));
onoff2.SetAttribute ("PacketSize", UintegerValue (50));
+3 -1
View File
@@ -136,7 +136,9 @@ main (int argc, char *argv[])
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
onoff.SetConstantRate (DataRate (6000));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
ApplicationContainer apps = onoff.Install (nA);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
+3 -1
View File
@@ -107,7 +107,9 @@ main (int argc, char *argv[])
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
onoff.SetConstantRate (DataRate (6000));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
ApplicationContainer apps = onoff.Install (nA);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
+21 -30
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
@@ -270,27 +268,19 @@ RoutingExperiment::Run (int nSinks, double txp, std::string CSVfileName)
NetDeviceContainer adhocDevices = wifi.Install (wifiPhy, wifiMac, adhocNodes);
MobilityHelper mobilityAdhoc;
int64_t streamIndex = 0; // used to get consistent mobility across scenarios
ObjectFactory pos;
pos.SetTypeId ("ns3::RandomRectanglePositionAllocator");
pos.Set ("X", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=300.0]"));
pos.Set ("Y", StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=1500.0]"));
pos.Set ("X", RandomVariableValue (UniformVariable (0.0, 300.0)));
pos.Set ("Y", RandomVariableValue (UniformVariable (0.0, 1500.0)));
Ptr<PositionAllocator> taPositionAlloc = pos.Create ()->GetObject<PositionAllocator> ();
streamIndex += taPositionAlloc->AssignStreams (streamIndex);
std::stringstream ssSpeed;
ssSpeed << "ns3::UniformRandomVariable[Min=0.0|Max=" << nodeSpeed << "]";
std::stringstream ssPause;
ssPause << "ns3::ConstantRandomVariable[Constant=" << nodePause << "]";
mobilityAdhoc.SetMobilityModel ("ns3::RandomWaypointMobilityModel",
"Speed", StringValue (ssSpeed.str ()),
"Pause", StringValue (ssPause.str ()),
"Speed", RandomVariableValue (UniformVariable (0.0, nodeSpeed)),
"Pause", RandomVariableValue (ConstantVariable (nodePause)),
"PositionAllocator", PointerValue (taPositionAlloc));
mobilityAdhoc.SetPositionAllocator (taPositionAlloc);
mobilityAdhoc.Install (adhocNodes);
streamIndex += mobilityAdhoc.AssignStreams (adhocNodes, streamIndex);
AodvHelper aodv;
OlsrHelper olsr;
@@ -340,8 +330,8 @@ RoutingExperiment::Run (int nSinks, double txp, std::string CSVfileName)
adhocInterfaces = addressAdhoc.Assign (adhocDevices);
OnOffHelper onoff1 ("ns3::UdpSocketFactory",Address ());
onoff1.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"));
onoff1.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.0]"));
onoff1.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff1.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
for (int i = 0; i <= nSinks - 1; i++)
{
@@ -350,9 +340,9 @@ RoutingExperiment::Run (int nSinks, double txp, std::string CSVfileName)
AddressValue remoteAddress (InetSocketAddress (adhocInterfaces.GetAddress (i), port));
onoff1.SetAttribute ("Remote", remoteAddress);
Ptr<UniformRandomVariable> var = CreateObject<UniformRandomVariable> ();
UniformVariable var;
ApplicationContainer temp = onoff1.Install (adhocNodes.Get (i + nSinks));
temp.Start (Seconds (var->GetValue (100.0,101.0)));
temp.Start (Seconds (var.GetValue (100.0,101.0)));
temp.Stop (Seconds (TotalTime));
}
@@ -378,8 +368,9 @@ RoutingExperiment::Run (int nSinks, double txp, std::string CSVfileName)
//AsciiTraceHelper ascii;
//Ptr<OutputStreamWrapper> osw = ascii.CreateFileStream ( (tr_name + ".tr").c_str());
//wifiPhy.EnableAsciiAll (osw);
AsciiTraceHelper ascii;
MobilityHelper::EnableAsciiAll (ascii.CreateFileStream (tr_name + ".mob"));
std::ofstream os;
os.open ((tr_name + ".mob").c_str ());
MobilityHelper::EnableAsciiAll (os);
//Ptr<FlowMonitor> flowmon;
//FlowMonitorHelper flowmonHelper;
+3 -1
View File
@@ -113,7 +113,9 @@ main (int argc, char *argv[])
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
InetSocketAddress (i5i6.GetAddress (1), port));
onoff.SetConstantRate (DataRate ("300bps"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", StringValue ("300bps"));
onoff.SetAttribute ("PacketSize", UintegerValue (50));
ApplicationContainer apps = onoff.Install (c.Get (0));
+2 -1
View File
@@ -140,7 +140,8 @@ main (int argc, char *argv[])
// Create a flow from n3 to n1, starting at time 1.1 seconds
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (i1i2.GetAddress (0), port)));
onoff.SetConstantRate (DataRate ("300b/s"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (c.Get (3));
apps.Start (Seconds (1.1));
+2 -1
View File
@@ -120,7 +120,8 @@ main (int argc, char *argv[])
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (i3i2.GetAddress (0), port)));
onoff.SetConstantRate (DataRate ("448kb/s"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (c.Get (0));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
+3 -1
View File
@@ -112,7 +112,9 @@ main (int argc, char *argv[])
uint16_t port = 9; // Discard port (RFC 863)
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (ifInAddrC.GetLocal (), port)));
onoff.SetConstantRate (DataRate (6000));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (6000)));
ApplicationContainer apps = onoff.Install (nA);
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
-158
View File
@@ -1,158 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* 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
*/
// Network topology
//
// n0 n1
// | |
// =================
// LAN
//
// - UDP flows from n0 to n1
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/csma-module.h"
#include "ns3/applications-module.h"
#include "ns3/internet-module.h"
#include "ns3/network-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("SocketOptionsIpv4");
void ReceivePacket (Ptr<Socket> socket)
{
NS_LOG_INFO ("Received one packet!");
Ptr<Packet> packet = socket->Recv ();
SocketIpTosTag tosTag;
if (packet->RemovePacketTag (tosTag))
{
NS_LOG_INFO (" TOS = " << (uint32_t)tosTag.GetTos ());
}
SocketIpTtlTag ttlTag;
if (packet->RemovePacketTag (ttlTag))
{
NS_LOG_INFO (" TTL = " << (uint32_t)ttlTag.GetTtl ());
}
}
static void SendPacket (Ptr<Socket> socket, uint32_t pktSize,
uint32_t pktCount, Time pktInterval )
{
if (pktCount > 0)
{
socket->Send (Create<Packet> (pktSize));
Simulator::Schedule (pktInterval, &SendPacket,
socket, pktSize,pktCount - 1, pktInterval);
}
else
{
socket->Close ();
}
}
int
main (int argc, char *argv[])
{
//
// Allow the user to override any of the defaults and the above Bind() at
// run-time, via command-line arguments
//
uint32_t packetSize = 1024;
uint32_t packetCount = 10;
double packetInterval = 1.0;
//Socket options for IPv4, currently TOS, TTL, RECVTOS, and RECVTTL
uint32_t ipTos = 0;
bool ipRecvTos = true;
uint32_t ipTtl = 0;
bool ipRecvTtl = true;
CommandLine cmd;
cmd.AddValue ("PacketSize", "Packet size in bytes", packetSize);
cmd.AddValue ("PacketCount", "Number of packets to send", packetCount);
cmd.AddValue ("Interval", "Interval between packets", packetInterval);
cmd.AddValue ("IP_TOS", "IP_TOS", ipTos);
cmd.AddValue ("IP_RECVTOS", "IP_RECVTOS", ipRecvTos);
cmd.AddValue ("IP_TTL", "IP_TTL", ipTtl);
cmd.AddValue ("IP_RECVTTL", "IP_RECVTTL", ipRecvTtl);
cmd.Parse (argc, argv);
NS_LOG_INFO ("Create nodes.");
NodeContainer n;
n.Create (2);
InternetStackHelper internet;
internet.Install (n);
Address serverAddress;
NS_LOG_INFO ("Create channels.");
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
csma.SetDeviceAttribute ("Mtu", UintegerValue (1400));
NetDeviceContainer d = csma.Install (n);
NS_LOG_INFO ("Assign IP Addresses.");
Ipv4AddressHelper ipv4;
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (d);
serverAddress = Address(i.GetAddress (1));
NS_LOG_INFO ("Create sockets.");
//Receiver socket on n1
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> recvSink = Socket::CreateSocket (n.Get (1), tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 4477);
recvSink->SetIpRecvTos (ipRecvTos);
recvSink->SetIpRecvTtl (ipRecvTtl);
recvSink->Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));
//Sender socket on n0
Ptr<Socket> source = Socket::CreateSocket (n.Get (0), tid);
InetSocketAddress remote = InetSocketAddress (i.GetAddress (1), 4477);
//Set socket options, it is also possible to set the options after the socket has been created/connected.
if (ipTos > 0)
{
source->SetIpTos (ipTos);
}
if (ipTtl > 0)
{
source->SetIpTtl (ipTtl);
}
source->Connect (remote);
AsciiTraceHelper ascii;
csma.EnableAsciiAll (ascii.CreateFileStream ("socket-options-ipv4.tr"));
csma.EnablePcapAll ("socket-options-ipv4", false);
//Schedule SendPacket
Time interPacketInterval = Seconds (packetInterval);
Simulator::ScheduleWithContext (source->GetNode ()->GetId (),
Seconds (1.0), &SendPacket,
source, packetSize, packetCount, interPacketInterval);
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
}
-157
View File
@@ -1,157 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* 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
*/
// Network topology
//
// n0 n1
// | |
// =================
// LAN
//
// - UDP flows from n0 to n1
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/csma-module.h"
#include "ns3/applications-module.h"
#include "ns3/internet-module.h"
#include "ns3/network-module.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("SocketOptionsIpv6");
void ReceivePacket (Ptr<Socket> socket)
{
NS_LOG_INFO ("Received one packet!");
Ptr<Packet> packet = socket->Recv ();
SocketIpv6TclassTag tclassTag;
if (packet->RemovePacketTag (tclassTag))
{
NS_LOG_INFO (" TCLASS = " << (uint32_t)tclassTag.GetTclass ());
}
SocketIpv6HopLimitTag hoplimitTag;
if (packet->RemovePacketTag (hoplimitTag))
{
NS_LOG_INFO (" HOPLIMIT = " << (uint32_t)hoplimitTag.GetHopLimit ());
}
}
static void SendPacket (Ptr<Socket> socket, uint32_t pktSize,
uint32_t pktCount, Time pktInterval )
{
if (pktCount > 0)
{
socket->Send (Create<Packet> (pktSize));
Simulator::Schedule (pktInterval, &SendPacket,
socket, pktSize,pktCount - 1, pktInterval);
}
else
{
socket->Close ();
}
}
int
main (int argc, char *argv[])
{
//
// Allow the user to override any of the defaults and the above Bind() at
// run-time, via command-line arguments
//
uint32_t packetSize = 1024;
uint32_t packetCount = 10;
double packetInterval = 1.0;
//Socket options for IPv6, currently TCLASS, HOPLIMIT, RECVTCLASS, and RECVHOPLIMIT
uint32_t ipv6Tclass = 0;
bool ipv6RecvTclass = true;
uint32_t ipv6Hoplimit = 0;
bool ipv6RecvHoplimit = true;
CommandLine cmd;
cmd.AddValue ("PacketSize", "Packet size in bytes", packetSize);
cmd.AddValue ("PacketCount", "Number of packets to send", packetCount);
cmd.AddValue ("Interval", "Interval between packets", packetInterval);
cmd.AddValue ("IPV6_TCLASS", "IPV6_TCLASS", ipv6Tclass);
cmd.AddValue ("IPV6_RECVTCLASS", "IPV6_RECVTCLASS", ipv6RecvTclass);
cmd.AddValue ("IPV6_HOPLIMIT", "IPV6_HOPLIMIT", ipv6Hoplimit);
cmd.AddValue ("IPV6_RECVHOPLIMIT", "IPV6_RECVHOPLIMIT", ipv6RecvHoplimit);
cmd.Parse (argc, argv);
NS_LOG_INFO ("Create nodes.");
NodeContainer n;
n.Create (2);
InternetStackHelper internet;
internet.Install (n);
Address serverAddress;
NS_LOG_INFO ("Create channels.");
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
csma.SetDeviceAttribute ("Mtu", UintegerValue (1400));
NetDeviceContainer d = csma.Install (n);
NS_LOG_INFO ("Assign IP Addresses.");
Ipv6AddressHelper ipv6;
ipv6.SetBase ("2001:0000:f00d:cafe::", Ipv6Prefix (64));
Ipv6InterfaceContainer i6 = ipv6.Assign (d);
serverAddress = Address(i6.GetAddress (1,1));
NS_LOG_INFO ("Create sockets.");
//Receiver socket on n1
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> recvSink = Socket::CreateSocket (n.Get (1), tid);
Inet6SocketAddress local = Inet6SocketAddress (Ipv6Address::GetAny (), 4477);
recvSink->SetIpv6RecvTclass (ipv6RecvTclass);
recvSink->SetIpv6RecvHopLimit (ipv6RecvHoplimit);
recvSink->Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));
//Sender socket on n0
Ptr<Socket> source = Socket::CreateSocket (n.Get (0), tid);
Inet6SocketAddress remote = Inet6SocketAddress (i6.GetAddress (1,1), 4477);
//Set socket options, it is also possible to set the options after the socket has been created/connected.
if (ipv6Tclass != 0)
{
source->SetIpv6Tclass (ipv6Tclass);
}
if (ipv6Hoplimit > 0)
{
source->SetIpv6HopLimit (ipv6Hoplimit);
}
source->Connect (remote);
AsciiTraceHelper ascii;
csma.EnableAsciiAll (ascii.CreateFileStream ("socket-options-ipv6.tr"));
csma.EnablePcapAll ("socket-options-ipv6", false);
//Schedule SendPacket
Time interPacketInterval = Seconds (packetInterval);
Simulator::ScheduleWithContext (source->GetNode ()->GetId (),
Seconds (1.0), &SendPacket,
source, packetSize, packetCount, interPacketInterval);
NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
Simulator::Destroy ();
NS_LOG_INFO ("Done.");
}
-6
View File
@@ -6,9 +6,3 @@ def build(bld):
obj = bld.create_ns3_program('socket-bound-tcp-static-routing', ['network', 'csma', 'point-to-point', 'internet'])
obj.source = 'socket-bound-tcp-static-routing.cc'
obj = bld.create_ns3_program('socket-options-ipv4', ['network', 'csma', 'point-to-point', 'internet'])
obj.source = 'socket-options-ipv4.cc'
obj = bld.create_ns3_program('socket-options-ipv6', ['network', 'csma', 'point-to-point', 'internet'])
obj.source = 'socket-options-ipv6.cc'
+4 -5
View File
@@ -62,9 +62,9 @@ Sender::GetTypeId (void)
MakeUintegerAccessor (&Sender::m_numPkts),
MakeUintegerChecker<uint32_t>(1))
.AddAttribute ("Interval", "Delay between transmissions.",
StringValue ("ns3::ConstantRandomVariable[Constant=0.5]"),
MakePointerAccessor (&Sender::m_interval),
MakePointerChecker <RandomVariableStream>())
RandomVariableValue (ConstantVariable (0.5)),
MakeRandomVariableAccessor (&Sender::m_interval),
MakeRandomVariableChecker ())
.AddTraceSource ("Tx", "A new packet is created and is sent",
MakeTraceSourceAccessor (&Sender::m_txTrace))
;
@@ -75,7 +75,6 @@ Sender::GetTypeId (void)
Sender::Sender()
{
NS_LOG_FUNCTION_NOARGS ();
m_interval = CreateObject<ConstantRandomVariable> ();
m_socket = 0;
}
@@ -140,7 +139,7 @@ void Sender::SendPacket ()
m_txTrace (packet);
if (++m_count < m_numPkts) {
m_sendEvent = Simulator::Schedule (Seconds (m_interval->GetValue ()),
m_sendEvent = Simulator::Schedule (Seconds (m_interval.GetValue ()),
&Sender::SendPacket, this);
}
+1 -1
View File
@@ -53,7 +53,7 @@ private:
uint32_t m_pktSize;
Ipv4Address m_destAddr;
uint32_t m_destPort;
Ptr<ConstantRandomVariable> m_interval;
RandomVariable m_interval;
uint32_t m_numPkts;
Ptr<Socket> m_socket;
+2 -2
View File
@@ -88,8 +88,8 @@ main (int argc, char *argv[])
// Create OnOff applications to send TCP to the hub, one on each spoke node.
//
OnOffHelper onOffHelper ("ns3::TcpSocketFactory", Address ());
onOffHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
onOffHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
onOffHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onOffHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer spokeApps;
+5 -4
View File
@@ -101,10 +101,11 @@ int main (int argc, char *argv[])
Ipv4InterfaceContainer ipv4Interfaces = ipv4.Assign (p2pInterfaces);
DoubleValue rate (errRate);
RandomVariableValue u01 (UniformVariable (0.0, 1.0));
Ptr<RateErrorModel> em1 =
CreateObjectWithAttributes<RateErrorModel> ("RanVar", StringValue ("ns3::UniformRandomVariable[Min=0.0,Max=1.0]"), "ErrorRate", rate);
CreateObjectWithAttributes<RateErrorModel> ("RanVar", u01, "ErrorRate", rate);
Ptr<RateErrorModel> em2 =
CreateObjectWithAttributes<RateErrorModel> ("RanVar", StringValue ("ns3::UniformRandomVariable[Min=0.0,Max=1.0]"), "ErrorRate", rate);
CreateObjectWithAttributes<RateErrorModel> ("RanVar", u01, "ErrorRate", rate);
// This enables the specified errRate on both link endpoints.
p2pInterfaces.Get (0)->SetAttribute ("ReceiveErrorModel", PointerValue (em1));
@@ -124,8 +125,8 @@ int main (int argc, char *argv[])
{
Address remoteAddress (InetSocketAddress (ipv4Interfaces.GetAddress (i), servPort));
OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress);
clientHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
clientHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
clientHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer clientApp = clientHelper.Install (n.Get (j));
clientApp.Start (Seconds (1.0 + i));
clientApp.Stop (Seconds (runtime + 1.0 + i));
+2 -2
View File
@@ -126,9 +126,9 @@ int main (int argc, char *argv[])
Address remoteAddress (InetSocketAddress (ipv4Interfaces.GetAddress (j), servPort));
OnOffHelper clientHelper ("ns3::TcpSocketFactory", remoteAddress);
clientHelper.SetAttribute
("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
("OnTime", RandomVariableValue (ConstantVariable (1)));
clientHelper.SetAttribute
("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer clientApp = clientHelper.Install (n.Get (i));
clientApp.Start (Seconds (j)); /* delay startup depending on node number */
clientApp.Stop (Seconds (j + runtime));
+4 -3
View File
@@ -136,9 +136,10 @@ main (int argc, char *argv[])
// Create the OnOff applications to send TCP to the server
OnOffHelper clientHelper ("ns3::TcpSocketFactory", Address ());
clientHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
clientHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
clientHelper.SetAttribute
("OnTime", RandomVariableValue (ConstantVariable (1)));
clientHelper.SetAttribute
("OffTime", RandomVariableValue (ConstantVariable (0)));
//normally wouldn't need a loop here but the server IP address is different
//on each p2p subnet
ApplicationContainer clientApps;
+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',
+3 -2
View File
@@ -185,8 +185,9 @@ main (int argc, char *argv[])
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);
Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ();
em->SetAttribute ("ErrorRate", DoubleValue (0.00001));
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> (
"RanVar", RandomVariableValue (UniformVariable (0., 1.)),
"ErrorRate", DoubleValue (0.00001));
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
InternetStackHelper stack;
+1 -1
View File
@@ -97,7 +97,7 @@ main (int argc, char *argv[])
UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (p2pNodes.Get (0));
+3 -2
View File
@@ -187,8 +187,9 @@ main (int argc, char *argv[])
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);
Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ();
em->SetAttribute ("ErrorRate", DoubleValue (0.00001));
Ptr<RateErrorModel> em = CreateObjectWithAttributes<RateErrorModel> (
"RanVar", RandomVariableValue (UniformVariable (0., 1.)),
"ErrorRate", DoubleValue (0.00001));
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
InternetStackHelper stack;
+1 -1
View File
@@ -157,7 +157,7 @@ main (int argc, char *argv[])
UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps =
+6 -6
View File
@@ -192,8 +192,8 @@ main (int argc, char *argv[])
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
"Bounds", RectangleValue (Rectangle (0, 20, 0, 20)),
"Speed", StringValue ("ns3::ConstantRandomVariable[Constant=2]"),
"Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.2]"));
"Speed", RandomVariableValue (ConstantVariable (2)),
"Pause", RandomVariableValue (ConstantVariable (0.2)));
mobility.Install (backbone);
///////////////////////////////////////////////////////////////////////////
@@ -318,8 +318,8 @@ main (int argc, char *argv[])
mobility.SetPositionAllocator (subnetAlloc);
mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
"Bounds", RectangleValue (Rectangle (-10, 10, -10, 10)),
"Speed", StringValue ("ns3::ConstantRandomVariable[Constant=3]"),
"Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.4]"));
"Speed", RandomVariableValue (ConstantVariable (3)),
"Pause", RandomVariableValue (ConstantVariable (0.4)));
mobility.Install (infra);
}
///////////////////////////////////////////////////////////////////////////
@@ -363,8 +363,8 @@ main (int argc, char *argv[])
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress (remoteAddr, port)));
onoff.SetConstantRate (DataRate ("10kb/s"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (appSource);
apps.Start (Seconds (3.0));
apps.Stop (Seconds (20.0));
+6 -5
View File
@@ -160,8 +160,8 @@ def main(argv):
mobility.SetPositionAllocator(positionAlloc)
mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
"Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle(0, 1000, 0, 1000)),
"Speed", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=2000]"),
"Pause", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0.2]"))
"Speed", ns.core.RandomVariableValue(ns.core.ConstantVariable(2000)),
"Pause", ns.core.RandomVariableValue(ns.core.ConstantVariable(0.2)))
mobility.Install(backbone)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
@@ -277,8 +277,8 @@ def main(argv):
mobility.SetPositionAllocator(subnetAlloc)
mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
"Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle(-25, 25, -25, 25)),
"Speed", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=30]"),
"Pause", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0.4]"))
"Speed", ns.core.RandomVariableValue(ns.core.ConstantVariable(30)),
"Pause", ns.core.RandomVariableValue(ns.core.ConstantVariable(0.4)))
mobility.Install(infra)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
@@ -301,7 +301,8 @@ def main(argv):
onoff = ns.applications.OnOffHelper("ns3::UdpSocketFactory",
ns.network.Address(ns.network.InetSocketAddress(remoteAddr, port)))
onoff.SetConstantRate (ns.network.DataRate ("10kb/s"))
onoff.SetAttribute("OnTime", ns.core.RandomVariableValue(ns.core.ConstantVariable(1)))
onoff.SetAttribute("OffTime", ns.core.RandomVariableValue(ns.core.ConstantVariable(0)))
apps = onoff.Install(ns.network.NodeContainer(appSource))
apps.Start(ns.core.Seconds(3.0))
apps.Stop(ns.core.Seconds(20.0))
+15 -21
View File
@@ -53,7 +53,7 @@
#include "ns3/applications-module.h"
#include "ns3/mobility-module.h"
#include "ns3/tools-module.h"
#include "ns3/random-variable-stream.h"
#include "ns3/random-variable.h"
#include "ns3/wifi-module.h"
#include "ns3/internet-module.h"
#include "ns3/flow-monitor-helper.h"
@@ -253,16 +253,12 @@ void
Experiment::SelectSrcDest (NodeContainer c)
{
uint32_t totalNodes = c.GetN ();
Ptr<UniformRandomVariable> uvSrc = CreateObject<UniformRandomVariable> ();
uvSrc->SetAttribute ("Min", DoubleValue (0));
uvSrc->SetAttribute ("Max", DoubleValue (totalNodes/2 -1));
Ptr<UniformRandomVariable> uvDest = CreateObject<UniformRandomVariable> ();
uvDest->SetAttribute ("Min", DoubleValue (totalNodes/2));
uvDest->SetAttribute ("Max", DoubleValue (totalNodes));
UniformVariable uvSrc (0, totalNodes/2 -1);
UniformVariable uvDest (totalNodes/2, totalNodes);
for (uint32_t i=0; i < totalNodes/3; i++)
{
ApplicationSetup (c.Get (uvSrc->GetInteger ()), c.Get (uvDest->GetInteger ()), 0, totalTime);
ApplicationSetup (c.Get (uvSrc.RandomVariable::GetInteger ()), c.Get (uvDest.RandomVariable::GetInteger ()), 0, totalTime);
}
}
@@ -276,26 +272,22 @@ void
Experiment::SendMultiDestinations (Ptr<Node> sender, NodeContainer c)
{
// UniformRandomVariable params: (Xrange, Yrange)
Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable> ();
uv->SetAttribute ("Min", DoubleValue (0));
uv->SetAttribute ("Max", DoubleValue (c.GetN ()));
// UniformVariable params: (Xrange, Yrange)
UniformVariable uv (0, c.GetN ());
// ExponentialRandomVariable params: (mean, upperbound)
Ptr<ExponentialRandomVariable> ev = CreateObject<ExponentialRandomVariable> ();
ev->SetAttribute ("Mean", DoubleValue (expMean));
ev->SetAttribute ("Bound", DoubleValue (totalTime));
// ExponentialVariable params: (mean, upperbound)
ExponentialVariable ev (expMean, totalTime);
double start=0.0, stop=totalTime;
uint32_t destIndex;
for (uint32_t i=0; i < c.GetN (); i++)
{
stop = start + ev->GetValue ();
stop = start + ev.GetValue ();
NS_LOG_DEBUG ("Start=" << start << " Stop=" << stop);
do {
destIndex = (uint32_t) uv->GetValue ();
destIndex = (uint32_t) uv.GetValue ();
} while ( (c.Get (destIndex))->GetId () == sender->GetId ());
ApplicationSetup (sender, c.Get (destIndex), start, stop);
@@ -355,7 +347,9 @@ Experiment::ApplicationSetup (Ptr<Node> client, Ptr<Node> server, double start,
// Equipping the source node with OnOff Application used for sending
OnOffHelper onoff ("ns3::UdpSocketFactory", Address (InetSocketAddress (Ipv4Address ("10.0.0.1"), port)));
onoff.SetConstantRate (DataRate (60000000));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (60000000)));
onoff.SetAttribute ("PacketSize", UintegerValue (packetSize));
onoff.SetAttribute ("Remote", AddressValue (InetSocketAddress (ipv4AddrServer, port)));
@@ -426,8 +420,8 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
//Rectangle (xMin, xMax, yMin, yMax)
mobil.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
"Bounds", RectangleValue (Rectangle (0, 500, 0, 500)),
"Speed", StringValue ("ns3::ConstantRandomVariable[Constant=10]"),
"Pause", StringValue ("ns3::ConstantRandomVariable[Constant=0.2]"));
"Speed", RandomVariableValue (ConstantVariable (10)),
"Pause", RandomVariableValue (ConstantVariable (0.2)));
}
mobil.Install (c);
+3 -1
View File
@@ -143,7 +143,9 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy,
socket.SetProtocol (1);
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
onoff.SetConstantRate (DataRate (60000000));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (250)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
onoff.SetAttribute ("DataRate", DataRateValue (DataRate (60000000)));
onoff.SetAttribute ("PacketSize", UintegerValue (2000));
ApplicationContainer apps = onoff.Install (c.Get (0));
+2 -1
View File
@@ -170,7 +170,8 @@ int main (int argc, char *argv[])
socket.SetProtocol (1);
OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket));
onoff.SetConstantRate (DataRate ("500kb/s"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (42)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (stas.Get (0));
apps.Start (Seconds (0.5));
+2 -1
View File
@@ -150,7 +150,8 @@ def main(argv):
socket.SetProtocol(1)
onoff = ns.applications.OnOffHelper("ns3::PacketSocketFactory", ns.network.Address(socket))
onoff.SetConstantRate (ns.network.DataRate ("500kb/s"))
onoff.SetAttribute("OnTime", ns.core.RandomVariableValue(ns.core.ConstantVariable(42)))
onoff.SetAttribute("OffTime", ns.core.RandomVariableValue(ns.core.ConstantVariable(0)))
apps = onoff.Install(ns.network.NodeContainer(stas.Get(0)))
apps.Start(ns.core.Seconds(0.5))
+2 -2
View File
@@ -121,8 +121,8 @@ int main (int argc, char const* argv[])
DataRate dataRate ("1Mb/s");
OnOffHelper onOff ("ns3::UdpSocketFactory", Address (InetSocketAddress (apIf.GetAddress (0), port)));
onOff.SetAttribute ("DataRate", DataRateValue (dataRate));
onOff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=0.01]"));
onOff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=8]"));
onOff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (0.01)));
onOff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (8)));
onOff.SetAttribute ("PacketSize", UintegerValue (50));
ApplicationContainer staApps = onOff.Install (sta);
+2 -2
View File
@@ -100,8 +100,8 @@ void experiment (bool enableCtsRts)
uint16_t cbrPort = 12345;
OnOffHelper onOffHelper ("ns3::UdpSocketFactory", InetSocketAddress (Ipv4Address ("10.0.0.2"), cbrPort));
onOffHelper.SetAttribute ("PacketSize", UintegerValue (200));
onOffHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
onOffHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
onOffHelper.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onOffHelper.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
// flow 1: node 0 -> node 1
onOffHelper.SetAttribute ("DataRate", StringValue ("3000000bps"));
+6 -4
View File
@@ -143,7 +143,7 @@ int main (int argc, char *argv[])
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel",
"Mode", StringValue ("Time"),
"Time", StringValue ("2s"),
"Speed", StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"),
"Speed", StringValue ("Constant:1.0"),
"Bounds", RectangleValue (Rectangle (wifiX, wifiX+5.0,0.0, (nStas+1)*5.0)));
mobility.Install (sta);
wifiMac.SetType ("ns3::StaWifiMac",
@@ -180,7 +180,8 @@ int main (int argc, char *argv[])
}
OnOffHelper onoff = OnOffHelper (protocol, dest);
onoff.SetConstantRate (DataRate ("500kb/s"));
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
ApplicationContainer apps = onoff.Install (staNodes[0].Get (0));
apps.Start (Seconds (0.5));
apps.Stop (Seconds (3.0));
@@ -190,8 +191,9 @@ int main (int argc, char *argv[])
if (writeMobility)
{
AsciiTraceHelper ascii;
MobilityHelper::EnableAsciiAll (ascii.CreateFileStream ("wifi-wired-bridging.mob"));
std::ofstream os;
os.open ("wifi-wired-bridging.mob");
MobilityHelper::EnableAsciiAll (os);
}
Simulator::Stop (Seconds (5.0));
Loaded 100 of 956 files, more files were not shown because too many files have changed in this diff. Show more