--- a/AUTHORS Tue May 29 10:42:17 2012 +0200
+++ b/AUTHORS Tue May 29 14:13:23 2012 +0200
@@ -1,4 +1,5 @@
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)
@@ -16,9 +17,11 @@
Gustavo Carneiro (gjc@inescporto.pt, gjcarneiro@gmail.com)
Egemen K. Cetinkaya (ekc@iitc.ku.edu)
Angelos Chatzipapas (chatzipa@ceid.upatras.gr)
+Yufei Cheng (yfcheng@ittc.ku.edu)
Andrey Churin (aachurin@gmail.com)
Salva Climent (jocliba@gmail.com)
Luis Cortes (cortes@gatech.edu)
+Luca Costantino (luca.costantino@gmail.com)
Craig Dowell (craigdo@ee.washington.edu)
Denis Fakhriev (fakhriev@iitp.ru)
Jahanzeb Farooq (Jahanzeb.Farooq@inria.fr, Jahanzeb.Farooq@gmail.com)
@@ -27,13 +30,15 @@
Charline Taibi Guguen (charline.guguen@gmail.com)
Tom Goff (tgoff@tgoff.net)
David Gross (gdavid.devel@gmail.com)
-Daniel Halperin <daniel@halper.in>
+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>
Mohamed Amine Ismail (amine.ismail@inria.fr, iamine@udcast.com)
Atishay Jain <atishayjain25@gmail.com>
-Sascha Alexander Jopen <jopen@informatik.uni-bonn.de>
+Sascha Alexander Jopen (jopen@informatik.uni-bonn.de)
Sam Jansen (sam.jansen@gmail.com)
Liu Jian (liujatp@gmail.com)
Joe Kopena (tjkopena@cs.drexel.edu)
@@ -48,13 +53,18 @@
Francesco Malandrino (francesco.malandrino@gmail.com)
Fabian Mauchle (f1mauchl@hsr.ch)
Andrey Mazo (mazo@iitp.ru)
-Vedran Miletić <rivanvx@gmail.com>
+Jonathan McCrohan (jmccroha@tcd.ie)
+Vedran Miletić (rivanvx@gmail.com)
+Marco Miozzo (mmiozzo@cttc.es)
Faker Moatamri (faker.moatamri@inria.fr)
+Mike Moreton (mjvm_ns@hotmail.com)
Sidharth Nabar (snabar@uw.edu)
Hemanth Narra (hemanth@ittc.ku.edu)
+Jaume Nin (jnin@cttc.es)
Michael Nowatkowski (nowatkom@gmail.com)
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>
Giuseppe Piro (g.piro@poliba.it)
@@ -63,7 +73,9 @@
Andrea Ranieri <andreran@uno.it>
Bruno Ranieri (Yrrsinn@googlemail.com)
Ken Renard (kenneth.renard@arl.army.mil)
+Manuel Requena (mrequena@cttc.es)
George F. Riley (riley@ece.gatech.edu)
+Sebastian Rohde (sebastian.rohde@tu-dortmund.de)
Bill Roome (wdr@bell-labs.com)
Andrea Sacco (andrea.sacco85@gmail.com)
Providence Salumu Munga (Providence.Salumu@gmail.com, Providence.Salumu_Munga@it-sudparis.eu)
--- a/CHANGES.html Tue May 29 10:42:17 2012 +0200
+++ b/CHANGES.html Tue May 29 14:13:23 2012 +0200
@@ -113,6 +113,13 @@
the merge of the code from the LENA project. The new API is not
backwards compatible with the previous version of the LTE module.
</li>
+<li> The Ipv6AddressHelper API has been aligned with the Ipv4AddressHelper API.
+The helper can be set with a call to Ipv6AddressHelper::SetBase
+(Ipv6Address network, Ipv6Prefix prefix) instead of NewNetwork
+(Ipv6Address network, Ipv6Prefix prefix). A new NewAddress (void) method
+has been added. Typical usage will involve calls to SetBase (), NewNetwork (),
+and NewAddress (), as in class Ipv4AddressHelper.
+</li>
</ul>
<h2>Changes to build system:</h2>
--- a/RELEASE_NOTES Tue May 29 10:42:17 2012 +0200
+++ b/RELEASE_NOTES Tue May 29 14:13:23 2012 +0200
@@ -9,57 +9,104 @@
Consult the file CHANGES.html for more detailed information about changed
API and behavior across ns-3 releases.
-Release 3-dev
-==============
+Release 3.14
+============
Availability
------------
-This release is available from:
+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 11.10 (32 bit) with g++-4.6.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
New user-visible features
-------------------------
-- Dual-stacked IPv6 sockets are implemented. An IPv6 socket can accept an IPv4
- connection, returning the senders address as an IPv4-mapped address
- (IPV6_V6ONLY socket option is not implemented).
-- Ipv6RoutingHelper is now in-line with Ipv4RoutingHelper concerning the RT
- 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",
- i.e., enable/disable the ICMPv6 Redirect sending.
+- 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 senders
+ address as an IPv4-mapped address (IPV6_V6ONLY socket option is not
+ implemented).
+- 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
ns-3 models library documentation for details.
-- Longer and more descriptive names are used for error units in RateErrorModel
- class and queue mode in Queue class. Attributs in those classes are also
- changed for consistency. See API documentation for details.
- A new buildings module is introduced which allows to model the
presence of buildings in a wireless network topology.
- New propagation models (OkumuraHata, ITU-R P.1411, ITU-R P.1238)
have been added
-- 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.
-
+- 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 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",
+ i.e., enable/disable the ICMPv6 Redirect sending.
+- 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 included with the release.
Bugs fixed
----------
- - bug 962 - list of paths to reach objects contains bogus entries
+ - 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
+ - bug 1109 - Point out the effects of ArpCache::PendingQueueSize
+ - bug 1179 - Add LTE trace hooks for supporting visualizer
+ - bug 1180 - LTE: Add TX/RX trace support
+ - bug 1273 - Better error message on missing Python development files
+ - bug 1282 - Sleep state and CCA
+ - bug 1283 - PacketSocket::SendTo should return number of bytes
+ - bug 1302 - Flow monitor bug
+ - bug 1304 - Tag information changed after transmission
- bug 1313 - Stddev (average.h) returning NaN
+ - bug 1318 - Asserts for IPv6 malformed packets
- bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
- - bug 1318 - Asserts for IPv6 malformed packets
+ - bug 1325 - Python examples get valgrind errors when build subdirectories
+ are specified in waf
- bug 1339 - test.py uses the old name for the test runner
+ - bug 1348 - python bindings: deprecated conversion from string constant
+ to ‘char*’
+ - bug 1349 - TypeId.LookupAttributeByName Python bindings missing
+ - bug 1350 - Simulator.ScheduleWithContext Python binding missing
+ - bug 1351 and 1333 - TCP not able to take RTT samples on long delay network
+ - bug 1352 - Fixed MapAttributes, previously was mapped to a vector in
+ ObjectPtrContainer and (and key information was dropped).
+ Now the container is a map.
+ - bug 1354 - Building scratch subdir programs is broken
+ - bug 1355 - Visualizer dependencies not detected at buildtime
- bug 1357 - IPv6 fragmentation fails due to checks about malformed extensions
+ - bug 1362 - ICMPv6 does not forward ICMPs to upper layers (and minor
+ fixes to ICMPv6)
+ - bug 1376 - wrong wind variable's name
- bug 1378 - UdpEchoClient::SetFill () does not set packet size correctly
- - bug 1351 and 1333 - TCP not able to take RTT samples on long delay network
- - bug 1362 - ICMPv6 does not forward ICMPs to upper layers (and minor fixes to ICMPv6)
+ - bug 1379 - lte-multiple-flows example crashes
+ - bug 1380 - lte-phy-uplink example crashes
- bug 1391 - .ns3rc does not allow comments as expected
- bug 1392 - Modules built report does not clarify C++ or Python
+ - bug 1393 - IPv6 Routing Helper RT Print functions
- bug 1395 - AODV DeferredRouteOutputTag missing constructor
- - bug 1352 - Fixed MapAttributes, previously was mapped to a vector in ObjectPtrContainer
- and (and key information was dropped). Now the container is a map.
+ - bug 1396 - ARP with hardware addresses longer than 6 bytes
+ - 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 - bug 1420: no python bindings for csma-layout
Known issues
------------
--- a/doc/models/Makefile Tue May 29 10:42:17 2012 +0200
+++ b/doc/models/Makefile Tue May 29 14:13:23 2012 +0200
@@ -101,7 +101,6 @@
$(SRC)/lte/doc/source/figures/lte-epc-e2e-data-protocol-stack.dia \
$(SRC)/lte/doc/source/figures/MCS_2_test.eps \
$(SRC)/lte/doc/source/figures/MCS_12_test.eps \
- $(SRC)/lte/doc/source/figures/MCS_14_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 \
@@ -136,8 +135,6 @@
$(SRC)/lte/doc/source/figures/MCS_17_20.png \
$(SRC)/lte/doc/source/figures/MCS_21_24.pdf \
$(SRC)/lte/doc/source/figures/MCS_21_24.png \
- $(SRC)/lte/doc/source/figures/MCS_25_27.pdf \
- $(SRC)/lte/doc/source/figures/MCS_25_27.png \
$(SRC)/lte/doc/source/figures/lte-phy-interference.png \
$(SRC)/lte/doc/source/figures/lte-phy-interference.pdf \
$(SRC)/lte/doc/source/figures/helpers.png \
@@ -147,8 +144,28 @@
$(SRC)/uan/doc/auvmobility-classes.dia \
$(SRC)/stats/doc/Stat-framework-arch.png \
$(SRC)/stats/doc/Wifi-default.png \
- $(SRC)/netanim/doc/animation-dumbbell.png \
- $(SRC)/netanim/doc/animation-dumbbell.pdf \
+ $(SRC)/netanim/doc/figures/Dumbbell.png \
+ $(SRC)/netanim/doc/figures/Dumbbell.pdf \
+ $(SRC)/netanim/doc/figures/PacketStatistics.png \
+ $(SRC)/netanim/doc/figures/PacketStatistics.pdf \
+ $(SRC)/netanim/doc/figures/FastForward.png \
+ $(SRC)/netanim/doc/figures/FastForward.pdf \
+ $(SRC)/netanim/doc/figures/Wireless.png \
+ $(SRC)/netanim/doc/figures/Wireless.pdf \
+ $(SRC)/netanim/doc/figures/Precision.png \
+ $(SRC)/netanim/doc/figures/Precision.pdf \
+ $(SRC)/netanim/doc/figures/Persist.png \
+ $(SRC)/netanim/doc/figures/Persist.pdf \
+ $(SRC)/netanim/doc/figures/SimTime.png \
+ $(SRC)/netanim/doc/figures/SimTime.pdf \
+ $(SRC)/netanim/doc/figures/Trajectory.png \
+ $(SRC)/netanim/doc/figures/Trajectory.pdf \
+ $(SRC)/netanim/doc/figures/UpdateRateInterval.png \
+ $(SRC)/netanim/doc/figures/UpdateRateInterval.pdf \
+ $(SRC)/netanim/doc/figures/WithoutPrecision.png \
+ $(SRC)/netanim/doc/figures/WithoutPrecision.pdf \
+ $(SRC)/netanim/doc/figures/WithPrecision.png \
+ $(SRC)/netanim/doc/figures/WithPrecision.pdf \
# specify figures from which .png and .pdf figures need to be
# generated (all dia and eps figures)
@@ -181,7 +198,6 @@
$(FIGURES)/lte-epc-e2e-data-protocol-stack.eps \
$(FIGURES)/MCS_2_test.eps \
$(FIGURES)/MCS_12_test.eps \
- $(FIGURES)/MCS_14_test.eps \
$(FIGURES)/lena-dual-stripe.eps \
$(FIGURES)/lte-mcs-index.eps \
$(FIGURES)/lenaThrTestCase1.eps \
--- a/examples/ipv6/fragmentation-ipv6.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/ipv6/fragmentation-ipv6.cc Tue May 29 14:13:23 2012 +0200
@@ -127,10 +127,10 @@
NS_LOG_INFO ("Create networks and assign IPv6 Addresses.");
Ipv6AddressHelper ipv6;
- ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i1 = ipv6.Assign (d1);
i1.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
i2.SetRouter (0, true);
--- a/examples/ipv6/icmpv6-redirect.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/ipv6/icmpv6-redirect.cc Tue May 29 14:13:23 2012 +0200
@@ -146,12 +146,12 @@
NS_LOG_INFO ("Assign IPv6 Addresses.");
Ipv6AddressHelper ipv6;
- ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64));
Ipv6InterfaceContainer iic1 = ipv6.Assign (ndc1);
iic1.SetRouter (2, true);
iic1.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64));
Ipv6InterfaceContainer iic2 = ipv6.Assign (ndc2);
iic2.SetRouter (0, true);
--- a/examples/ipv6/loose-routing-ipv6.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/ipv6/loose-routing-ipv6.cc Tue May 29 14:13:23 2012 +0200
@@ -104,30 +104,30 @@
NS_LOG_INFO ("Create networks and assign IPv6 Addresses.");
Ipv6AddressHelper ipv6;
- ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i1 = ipv6.Assign (d1);
i1.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
i2.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:3::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:3::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i3 = ipv6.Assign (d3);
i3.SetRouter (0, true);
i3.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:4::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:4::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i4 = ipv6.Assign (d4);
i4.SetRouter (0, true);
i4.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:5::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:5::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i5 = ipv6.Assign (d5);
i5.SetRouter (0, true);
i5.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:6::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:6::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i6 = ipv6.Assign (d6);
i6.SetRouter (0, true);
i6.SetRouter (1, true);
--- a/examples/ipv6/radvd-two-prefix.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/ipv6/radvd-two-prefix.cc Tue May 29 14:13:23 2012 +0200
@@ -137,7 +137,7 @@
Ipv6AddressHelper ipv6;
/* first subnet */
- ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64));
NetDeviceContainer tmp;
tmp.Add (d1.Get (0)); /* n0 */
Ipv6InterfaceContainer iic1 = ipv6.AssignWithoutAddress (tmp); /* n0 interface */
@@ -152,7 +152,7 @@
stackHelper.AddAddress (r, iic1.GetInterfaceIndex (1), Ipv6Address ("2001:ABCD::2"));
/* second subnet R - n1 */
- ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64));
NetDeviceContainer tmp3;
tmp3.Add (d2.Get (0)); /* R */
Ipv6InterfaceContainer iicr2 = ipv6.Assign (tmp3); /* R interface */
--- a/examples/ipv6/radvd.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/ipv6/radvd.cc Tue May 29 14:13:23 2012 +0200
@@ -84,7 +84,7 @@
Ipv6AddressHelper ipv6;
/* first subnet */
- ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64));
NetDeviceContainer tmp;
tmp.Add (d1.Get (0)); /* n0 */
Ipv6InterfaceContainer iic1 = ipv6.AssignWithoutAddress (tmp); /* n0 interface */
@@ -96,7 +96,7 @@
iic1.Add (iicr1);
/* second subnet R - n1 */
- ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64));
NetDeviceContainer tmp3;
tmp3.Add (d2.Get (0)); /* R */
Ipv6InterfaceContainer iicr2 = ipv6.Assign (tmp3); /* R interface */
--- a/examples/routing/simple-routing-ping6.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/routing/simple-routing-ping6.cc Tue May 29 14:13:23 2012 +0200
@@ -128,10 +128,10 @@
NS_LOG_INFO ("Create networks and assign IPv6 Addresses.");
Ipv6AddressHelper ipv6;
- ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i1 = ipv6.Assign (d1);
i1.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
+ ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64));
Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
i2.SetRouter (0, true);
--- a/examples/udp-client-server/udp-client-server.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/udp-client-server/udp-client-server.cc Tue May 29 14:13:23 2012 +0200
@@ -84,7 +84,7 @@
else
{
Ipv6AddressHelper ipv6;
- ipv6.NewNetwork ("2001:0000:f00d:cafe::", 64);
+ ipv6.SetBase ("2001:0000:f00d:cafe::", Ipv6Prefix (64));
Ipv6InterfaceContainer i6 = ipv6.Assign (d);
serverAddress = Address(i6.GetAddress (1,1));
}
--- a/examples/udp-client-server/udp-trace-client-server.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/udp-client-server/udp-trace-client-server.cc Tue May 29 14:13:23 2012 +0200
@@ -83,7 +83,7 @@
else
{
Ipv6AddressHelper ipv6;
- ipv6.NewNetwork ("2001:0000:f00d:cafe::", 64);
+ ipv6.SetBase ("2001:0000:f00d:cafe::", Ipv6Prefix (64));
Ipv6InterfaceContainer i6 = ipv6.Assign (d);
serverAddress = Address(i6.GetAddress (1,1));
}
--- a/examples/udp/udp-echo.cc Tue May 29 10:42:17 2012 +0200
+++ b/examples/udp/udp-echo.cc Tue May 29 14:13:23 2012 +0200
@@ -91,7 +91,7 @@
else
{
Ipv6AddressHelper ipv6;
- ipv6.NewNetwork ("2001:0000:f00d:cafe::", 64);
+ ipv6.SetBase ("2001:0000:f00d:cafe::", Ipv6Prefix (64));
Ipv6InterfaceContainer i6 = ipv6.Assign (d);
serverAddress = Address(i6.GetAddress (1,1));
}
--- a/src/buildings/test/building-position-allocator-test.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/buildings/test/building-position-allocator-test.cc Tue May 29 14:13:23 2012 +0200
@@ -32,7 +32,7 @@
NS_LOG_COMPONENT_DEFINE ("BuildingPositionAllocatorTest");
-using namespace ns3;
+namespace ns3 {
@@ -237,3 +237,6 @@
}
static BuildingPositionAllocatorTestSuite buildingsPositionAllocatorTestSuiteInstance;
+
+} // namespace ns3
+
--- a/src/buildings/test/buildings-helper-test.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/buildings/test/buildings-helper-test.cc Tue May 29 14:13:23 2012 +0200
@@ -30,7 +30,7 @@
NS_LOG_COMPONENT_DEFINE ("BuildingsHelperTest");
-using namespace ns3;
+namespace ns3 {
struct PositionInBuilding
@@ -323,3 +323,6 @@
}
static BuildingsHelperTestSuite buildingsHelperAntennaTestSuiteInstance;
+
+} // namespace ns3
+
--- a/src/buildings/test/buildings-pathloss-test.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/buildings/test/buildings-pathloss-test.cc Tue May 29 14:13:23 2012 +0200
@@ -24,12 +24,13 @@
#include <ns3/log.h>
#include <ns3/buildings-helper.h>
-#include <ns3/buildings-pathloss-test.h>
-#include "ns3/string.h"
-#include "ns3/double.h"
+#include <ns3/string.h>
+#include <ns3/double.h>
#include <ns3/building.h>
#include <ns3/enum.h>
+#include "buildings-pathloss-test.h"
+
NS_LOG_COMPONENT_DEFINE ("BuildingsPathlossTest");
--- a/src/buildings/test/buildings-shadowing-test.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/buildings/test/buildings-shadowing-test.cc Tue May 29 14:13:23 2012 +0200
@@ -19,16 +19,17 @@
* Nicola Baldo <nbaldo@cttc.es>
*/
-#include "ns3/simulator.h"
-#include "ns3/log.h"
-#include "ns3/buildings-shadowing-test.h"
+#include <ns3/simulator.h>
+#include <ns3/log.h>
#include <ns3/hybrid-buildings-propagation-loss-model.h>
-#include "ns3/string.h"
-#include "ns3/double.h"
+#include <ns3/string.h>
+#include <ns3/double.h>
#include <ns3/building.h>
#include <ns3/enum.h>
#include <ns3/buildings-helper.h>
+#include "buildings-shadowing-test.h"
+
NS_LOG_COMPONENT_DEFINE ("BuildingsShadowingTest");
--- a/src/buildings/wscript Tue May 29 10:42:17 2012 +0200
+++ b/src/buildings/wscript Tue May 29 14:13:23 2012 +0200
@@ -39,8 +39,6 @@
'helper/building-allocator.h',
'helper/building-position-allocator.h',
'helper/buildings-helper.h',
- 'test/buildings-pathloss-test.h',
- 'test/buildings-shadowing-test.h',
]
if (bld.env['ENABLE_EXAMPLES']):
--- a/src/csma-layout/examples/csma-star.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/csma-layout/examples/csma-star.cc Tue May 29 14:13:23 2012 +0200
@@ -142,7 +142,7 @@
{
Ipv6AddressGenerator::Init (ipv6AddressBase, ipv6AddressPrefix);
Ipv6Address v6network = Ipv6AddressGenerator::GetNetwork (ipv6AddressPrefix);
- address6.NewNetwork(v6network, ipv6AddressPrefix);
+ address6.SetBase (v6network, ipv6AddressPrefix);
for (uint32_t j = 0; j < nFill; ++j)
{
--- a/src/csma-layout/model/csma-star-helper.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/csma-layout/model/csma-star-helper.cc Tue May 29 14:13:23 2012 +0200
@@ -129,7 +129,7 @@
for (uint32_t i = 0; i < m_spokes.GetN (); ++i)
{
v6network = Ipv6AddressGenerator::GetNetwork (prefix);
- addressHelper.NewNetwork(v6network, prefix);
+ addressHelper.SetBase (v6network, prefix);
Ipv6InterfaceContainer ic = addressHelper.Assign (m_hubDevices.Get (i));
m_hubInterfaces6.Add (ic);
--- a/src/internet/bindings/modulegen__gcc_ILP32.py Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/bindings/modulegen__gcc_ILP32.py Tue May 29 14:13:23 2012 +0200
@@ -2822,6 +2822,8 @@
cls.add_constructor([param('ns3::Ipv6AddressHelper const &', 'arg0')])
## ipv6-address-helper.h (module 'internet'): ns3::Ipv6AddressHelper::Ipv6AddressHelper() [constructor]
cls.add_constructor([])
+ ## ipv6-address-helper.h (module 'internet'): ns3::Ipv6AddressHelper::Ipv6AddressHelper(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, ns3::Ipv6Address base=ns3::Ipv6Address(((const char*)"::1"))) [constructor]
+ cls.add_constructor([param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('ns3::Ipv6Address', 'base', default_value='ns3::Ipv6Address(((const char*)"::1"))')])
## ipv6-address-helper.h (module 'internet'): ns3::Ipv6InterfaceContainer ns3::Ipv6AddressHelper::Assign(ns3::NetDeviceContainer const & c) [member function]
cls.add_method('Assign',
'ns3::Ipv6InterfaceContainer',
@@ -2838,10 +2840,23 @@
cls.add_method('NewAddress',
'ns3::Ipv6Address',
[param('ns3::Address', 'addr')])
+ ## ipv6-address-helper.h (module 'internet'): ns3::Ipv6Address ns3::Ipv6AddressHelper::NewAddress() [member function]
+ cls.add_method('NewAddress',
+ 'ns3::Ipv6Address',
+ [])
## ipv6-address-helper.h (module 'internet'): void ns3::Ipv6AddressHelper::NewNetwork(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix) [member function]
cls.add_method('NewNetwork',
'void',
- [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix')])
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix')],
+ deprecated=True)
+ ## ipv6-address-helper.h (module 'internet'): void ns3::Ipv6AddressHelper::NewNetwork() [member function]
+ cls.add_method('NewNetwork',
+ 'void',
+ [])
+ ## ipv6-address-helper.h (module 'internet'): void ns3::Ipv6AddressHelper::SetBase(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, ns3::Ipv6Address base=ns3::Ipv6Address(((const char*)"::1"))) [member function]
+ cls.add_method('SetBase',
+ 'void',
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('ns3::Ipv6Address', 'base', default_value='ns3::Ipv6Address(((const char*)"::1"))')])
return
def register_Ns3Ipv6InterfaceAddress_methods(root_module, cls):
--- a/src/internet/bindings/modulegen__gcc_LP64.py Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/bindings/modulegen__gcc_LP64.py Tue May 29 14:13:23 2012 +0200
@@ -2822,6 +2822,8 @@
cls.add_constructor([param('ns3::Ipv6AddressHelper const &', 'arg0')])
## ipv6-address-helper.h (module 'internet'): ns3::Ipv6AddressHelper::Ipv6AddressHelper() [constructor]
cls.add_constructor([])
+ ## ipv6-address-helper.h (module 'internet'): ns3::Ipv6AddressHelper::Ipv6AddressHelper(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, ns3::Ipv6Address base=ns3::Ipv6Address(((const char*)"::1"))) [constructor]
+ cls.add_constructor([param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('ns3::Ipv6Address', 'base', default_value='ns3::Ipv6Address(((const char*)"::1"))')])
## ipv6-address-helper.h (module 'internet'): ns3::Ipv6InterfaceContainer ns3::Ipv6AddressHelper::Assign(ns3::NetDeviceContainer const & c) [member function]
cls.add_method('Assign',
'ns3::Ipv6InterfaceContainer',
@@ -2838,10 +2840,23 @@
cls.add_method('NewAddress',
'ns3::Ipv6Address',
[param('ns3::Address', 'addr')])
+ ## ipv6-address-helper.h (module 'internet'): ns3::Ipv6Address ns3::Ipv6AddressHelper::NewAddress() [member function]
+ cls.add_method('NewAddress',
+ 'ns3::Ipv6Address',
+ [])
## ipv6-address-helper.h (module 'internet'): void ns3::Ipv6AddressHelper::NewNetwork(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix) [member function]
cls.add_method('NewNetwork',
'void',
- [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix')])
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix')],
+ deprecated=True)
+ ## ipv6-address-helper.h (module 'internet'): void ns3::Ipv6AddressHelper::NewNetwork() [member function]
+ cls.add_method('NewNetwork',
+ 'void',
+ [])
+ ## ipv6-address-helper.h (module 'internet'): void ns3::Ipv6AddressHelper::SetBase(ns3::Ipv6Address network, ns3::Ipv6Prefix prefix, ns3::Ipv6Address base=ns3::Ipv6Address(((const char*)"::1"))) [member function]
+ cls.add_method('SetBase',
+ 'void',
+ [param('ns3::Ipv6Address', 'network'), param('ns3::Ipv6Prefix', 'prefix'), param('ns3::Ipv6Address', 'base', default_value='ns3::Ipv6Address(((const char*)"::1"))')])
return
def register_Ns3Ipv6InterfaceAddress_methods(root_module, cls):
--- a/src/internet/helper/ipv6-address-helper.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/helper/ipv6-address-helper.cc Tue May 29 14:13:23 2012 +0200
@@ -25,6 +25,7 @@
#include "ns3/net-device.h"
#include "ns3/mac48-address.h"
#include "ns3/ipv6.h"
+#include "ns3/ipv6-address-generator.h"
#include "ipv6-address-helper.h"
@@ -35,37 +36,73 @@
Ipv6AddressHelper::Ipv6AddressHelper ()
{
- NS_LOG_FUNCTION_NOARGS ();
- m_network = Ipv6Address ("2001::");
- m_prefix = Ipv6Prefix (64);
+ NS_LOG_FUNCTION (this);
+ Ipv6AddressGenerator::Init (Ipv6Address ("2001:db8::"), Ipv6Prefix (64));
+}
+
+Ipv6AddressHelper::Ipv6AddressHelper (Ipv6Address network, Ipv6Prefix prefix,
+ Ipv6Address base)
+{
+ NS_LOG_FUNCTION (this << network << prefix << base);
+ Ipv6AddressGenerator::Init (network, prefix, base);
}
+void Ipv6AddressHelper::SetBase (Ipv6Address network, Ipv6Prefix prefix,
+ Ipv6Address base)
+{
+ NS_LOG_FUNCTION (this << network << prefix << base);
+ // XXX for now we do not enforce the prefix because the underlying
+ // Ipv6AddressGenerator does not handle prefixes well that are not 64 bits
+ Ipv6AddressGenerator::Init (network, Ipv6Prefix (64), base);
+}
+
+
Ipv6Address Ipv6AddressHelper::NewAddress (Address addr)
{
NS_LOG_FUNCTION (this << addr);
-
- switch (addr.GetLength ())
+ if (Mac48Address::IsMatchingType (addr))
{
- case 6:
- return Ipv6Address::MakeAutoconfiguredAddress (Mac48Address::ConvertFrom (addr), m_network);
- default:
- return Ipv6Address ("::");
+ Ipv6Address network = Ipv6AddressGenerator::GetNetwork (Ipv6Prefix (64));
+ Ipv6Address address = Ipv6Address::MakeAutoconfiguredAddress (Mac48Address::ConvertFrom (addr), network);
+ Ipv6AddressGenerator::AddAllocated (address);
+ return address;
+ }
+ else
+ {
+ NS_FATAL_ERROR ("Did not pass in a Mac48Address");
}
/* never reached */
return Ipv6Address ("::");
}
+Ipv6Address Ipv6AddressHelper::NewAddress (void)
+{
+ NS_LOG_FUNCTION (this);
+//
+// The way this is expected to be used is that an address and network number
+// are initialized, and then NewAddress() is called repeatedly to allocate and
+// get new addresses on a given subnet. The client will expect that the first
+// address she gets back is the one she used to initialize the generator with.
+// This implies that this operation is a post-increment.
+//
+ return Ipv6AddressGenerator::NextAddress (Ipv6Prefix (64));
+}
+
void Ipv6AddressHelper::NewNetwork (Ipv6Address network, Ipv6Prefix prefix)
{
NS_LOG_FUNCTION (this << network << prefix);
+ SetBase (network, Ipv6Prefix (64));
+}
- m_network = network;
- m_prefix = prefix;
+void Ipv6AddressHelper::NewNetwork (void)
+{
+ NS_LOG_FUNCTION (this);
+ Ipv6AddressGenerator::NextNetwork (Ipv6Prefix (64));
}
Ipv6InterfaceContainer Ipv6AddressHelper::Assign (const NetDeviceContainer &c)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
Ipv6InterfaceContainer retval;
for (uint32_t i = 0; i < c.GetN (); ++i)
@@ -87,10 +124,10 @@
NS_ASSERT_MSG (ifIndex >= 0, "Ipv6AddressHelper::Allocate (): "
"Interface index not found");
- Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (NewAddress (device->GetAddress ()), m_prefix);
+ Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (NewAddress (device->GetAddress ()), Ipv6Prefix (64));
ipv6->SetMetric (ifIndex, 1);
+ ipv6->AddAddress (ifIndex, ipv6Addr);
ipv6->SetUp (ifIndex);
- ipv6->AddAddress (ifIndex, ipv6Addr);
retval.Add (ipv6, ifIndex);
}
@@ -99,7 +136,7 @@
Ipv6InterfaceContainer Ipv6AddressHelper::Assign (const NetDeviceContainer &c, std::vector<bool> withConfiguration)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
Ipv6InterfaceContainer retval;
for (uint32_t i = 0; i < c.GetN (); ++i)
{
@@ -120,47 +157,29 @@
"Interface index not found");
ipv6->SetMetric (ifIndex, 1);
- ipv6->SetUp (ifIndex);
if (withConfiguration.at (i))
{
- Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (NewAddress (device->GetAddress ()), m_prefix);
+ Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (NewAddress (device->GetAddress ()), Ipv6Prefix (64));
ipv6->AddAddress (ifIndex, ipv6Addr);
}
+ ipv6->SetUp (ifIndex);
retval.Add (ipv6, ifIndex);
}
return retval;
}
+// Helper API that is redundant with Assign (c, false);
Ipv6InterfaceContainer Ipv6AddressHelper::AssignWithoutAddress (const NetDeviceContainer &c)
{
- NS_LOG_FUNCTION_NOARGS ();
- Ipv6InterfaceContainer retval;
+ NS_LOG_FUNCTION (this);
+ std::vector<bool> withConfiguration;
for (uint32_t i = 0; i < c.GetN (); ++i)
{
- Ptr<NetDevice> device = c.Get (i);
-
- Ptr<Node> node = device->GetNode ();
- NS_ASSERT_MSG (node, "Ipv6AddressHelper::Allocate (): Bad node");
-
- Ptr<Ipv6> ipv6 = node->GetObject<Ipv6> ();
- NS_ASSERT_MSG (ipv6, "Ipv6AddressHelper::Allocate (): Bad ipv6");
-
- int32_t ifIndex = ipv6->GetInterfaceForDevice (device);
- if (ifIndex == -1)
- {
- ifIndex = ipv6->AddInterface (device);
- }
- NS_ASSERT_MSG (ifIndex >= 0, "Ipv6AddressHelper::Allocate (): "
- "Interface index not found");
-
- ipv6->SetMetric (ifIndex, 1);
- ipv6->SetUp (ifIndex);
-
- retval.Add (ipv6, ifIndex);
+ withConfiguration.push_back (false);
}
- return retval;
+ return Assign (c, withConfiguration);
}
} /* namespace ns3 */
--- a/src/internet/helper/ipv6-address-helper.h Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/helper/ipv6-address-helper.h Tue May 29 14:13:23 2012 +0200
@@ -16,24 +16,63 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
+ * modified by Tom Henderson for ns-3.14 release
*/
-#ifndef IPV6_ADDRESS_STATIC_HELPER_H
-#define IPV6_ADDRESS_STATIC_HELPER_H
+#ifndef IPV6_ADDRESS_HELPER_H
+#define IPV6_ADDRESS_HELPER_H
#include <vector>
#include "ns3/ipv6-address.h"
-
#include "ns3/net-device-container.h"
#include "ipv6-interface-container.h"
+#include "ns3/deprecated.h"
-namespace ns3
-{
+namespace ns3 {
/**
* \class Ipv6AddressHelper
- * \brief Helper class to assign IPv6 address statically.
+ * \brief Helper class to auto-assign global IPv6 unicast addresses
+ *
+ * Assign global unicast IPv6 addresses based on RFC 4291 definition.
+ *
+ * | n bits | 64-n bits | 64 bits |
+ * +-------------------------+-----------+----------------------------+
+ * | global routing prefix | subnet ID | interface ID |
+ * +-------------------------+-----------+----------------------------+
+ * <-------------network---------------->
+ *
+ * 11111111111111111111111111000000000000
+ * <---prefix of length n--->
+ *
+ * This class handles the following quantities.
+ * 1) The "network" which covers the 64 bit union of the global routing
+ * prefix and the subnet ID
+ * 2) the "prefix" length "n" which demarcates the global routing prefix
+ * and the subnet ID
+ * 3) the "base" which is the initial 64-bit interface ID.
+ *
+ * The names "network", "prefix" and "base" are chosen to be consistent
+ * with a similar address helper for IPv4.
+ *
+ * This helper class allows users to set or reset the network and
+ * interface components, and call "NewAddress ()" to sequentially increment
+ * the interface ID, and call "NewNetwork ()" to allocate a new subnet
+ * (until the subnet ID quantity rolls over). A call to NewNetwork ()
+ * that causes the subnet ID to roll over will trigger an assertion.
+ *
+ * By default, the prefix is 32 bits and the network is '2001:db8::/32'
+ * (RFC 5156 section 2.6 Documentation prefix). The prefix may range
+ * from length 0 to 64, with the value 64 having a special meaning that
+ * no subnet ID boundary is enforced (equivalent to value 0).
+ *
+ * There are two variants of interface ID supported (RFC 4291, Sec. 2.5.1)
+ * The default is a "local" scope, but a "universal" scoped ID may be
+ * formed by calling "NewAddress (Address addr)" with a 48-bit MAC address.
+ * If this method is called, the addressed returned will include a
+ * modified EUI-64-format identifier created from the MAC address as
+ * specified in RFC 4291.
*/
class Ipv6AddressHelper
{
@@ -44,36 +83,92 @@
Ipv6AddressHelper ();
/**
+ * \brief Constructor.
+ * \param network The IPv6 network
+ * \param prefix The prefix
+ * \param base The base interface ID
+ */
+ Ipv6AddressHelper (Ipv6Address network, Ipv6Prefix prefix,
+ Ipv6Address base = Ipv6Address ("::1"));
+
+ /**
+ * \brief Set the base network number, network prefix, and base interface ID
+ *
+ * \param network The IPv6 network
+ * \param prefix The prefix
+ * \param base The base interface ID
+ */
+ void SetBase (Ipv6Address network, Ipv6Prefix prefix,
+ Ipv6Address base = Ipv6Address ("::1"));
+
+ /**
* \brief Allocate a new network.
+ *
+ * This method will reset the network for future
+ * network IDs, and resets the interface ID to the previously used
+ * base.
+ *
* \param network The IPv6 network
* \param prefix The prefix
*/
- void NewNetwork (Ipv6Address network, Ipv6Prefix prefix);
+ void NewNetwork (Ipv6Address network, Ipv6Prefix prefix) NS_DEPRECATED;
/**
- * \brief Allocate a new address.
- * \param addr L2 address (currently only ethernet address is supported)
+ * \brief Allocate a new network.
+ *
+ * This method will cause the subnet prefix to increment, for future
+ * network IDs, and resets the interface ID to the previously used
+ * base.
+ */
+ void NewNetwork (void);
+
+ /**
+ * \brief Allocate a new Ipv6Address.
+ *
+ * If a Mac48Address is passed in, an Ipv6 autoconfigured address
+ * according to the current subnet prefix is returned. If something
+ * other than Mac48 address is passed in, the program will terminate.
+ *
+ * \param addr address used to generate the interface ID of the IPv6 address
* \return newly created Ipv6Address
*/
Ipv6Address NewAddress (Address addr);
/**
- * \brief Allocate an Ipv6InterfaceContainer.
+ * \brief Allocate a new Ipv6Address with interface ID equal to the
+ * next one in the underlying generator.
+ *
+ * \return newly created Ipv6Address
+ */
+ Ipv6Address NewAddress (void);
+
+ /**
+ * \brief Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
* \param c netdevice container
* \return newly created Ipv6InterfaceContainer
*/
Ipv6InterfaceContainer Assign (const NetDeviceContainer &c);
/**
- * \brief Allocate an Ipv6InterfaceContainer.
+ * \brief Allocate an Ipv6InterfaceContainer, and control whether the
+ * interfaces have addresses auto-assigned to them
+ *
* \param c netdevice container
- * \param withConfiguration true : interface statically configured, false : no static configuration
+ * \param withConfiguration a vector of values for which, for a
+ * given device, true : interface automatically addressed,
+ * false : no automatic address
* \return newly created Ipv6InterfaceContainer
*/
Ipv6InterfaceContainer Assign (const NetDeviceContainer &c, std::vector<bool> withConfiguration);
/**
- * \brief Allocate an Ipv6InterfaceContainer without static IPv6 configuration.
+ * \brief Allocate an Ipv6InterfaceContainer but do not assign any IPv6 addresses
+ *
+ * This method is used when IPv6 address assignment may occur later
+ * (such as dynamic address assignment)
+ *
+ * Equivalent to AssignWithoutAddress (c, std::vector<bool> of false);
+ *
* \param c netdevice container
* \return newly created Ipv6InterfaceContainer
*/
@@ -84,16 +179,27 @@
* \internal
* \brief The IPv6 network.
*/
- Ipv6Address m_network;
+ uint8_t m_network[16];
/**
* \internal
- * \brief IPv6 The prefix (mask).
+ * \brief The prefix (mask).
*/
- Ipv6Prefix m_prefix;
+ uint8_t m_prefix[16];
+
+ /**
+ * \internal
+ * \brief The base interface ID
+ */
+ uint64_t m_base;
+ /**
+ * \internal
+ * \brief The current interface ID
+ */
+ uint64_t m_iid;
};
} /* namespace ns3 */
-#endif /* IPV6_ADDRESS_STATIC_HELPER_H */
+#endif /* IPV6_ADDRESS_STATIC_H */
--- a/src/internet/model/arp-header.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/model/arp-header.cc Tue May 29 14:13:23 2012 +0200
@@ -121,8 +121,13 @@
uint32_t
ArpHeader::GetSerializedSize (void) const
{
- /* this is the size of an ARP payload. */
- return 28;
+ NS_ASSERT((m_macSource.GetLength () == 6) || (m_macSource.GetLength () == 8));
+ NS_ASSERT (m_macSource.GetLength () == m_macDest.GetLength ());
+
+ uint32_t length = 16; // Length minus two hardware addresses
+ length += m_macSource.GetLength () * 2;
+
+ return length;
}
void
--- a/src/internet/model/ipv6-address-generator.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/model/ipv6-address-generator.cc Tue May 29 14:13:23 2012 +0200
@@ -160,6 +160,7 @@
// network number at bit zero of the int that holds it).
//
uint32_t index = PrefixToIndex (prefix);
+ NS_LOG_DEBUG ("Index " << index);
uint32_t a = m_netTable[index].shift / 8;
uint32_t b = m_netTable[index].shift % 8;
for (int32_t j = 15 - a; j >= 0; j--)
--- a/src/internet/test/ipv4-address-helper-test-suite.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/test/ipv4-address-helper-test-suite.cc Tue May 29 14:13:23 2012 +0200
@@ -179,6 +179,82 @@
Simulator::Destroy ();
}
+class IpAddressHelperTestCasev4 : public TestCase
+{
+public:
+ IpAddressHelperTestCasev4 ();
+ virtual ~IpAddressHelperTestCasev4 ();
+
+private:
+ virtual void DoRun (void);
+ virtual void DoTeardown (void);
+};
+
+IpAddressHelperTestCasev4::IpAddressHelperTestCasev4 ()
+ : TestCase ("IpAddressHelper Ipv4 test case (similar to IPv6)")
+{
+}
+
+IpAddressHelperTestCasev4::~IpAddressHelperTestCasev4 ()
+{
+}
+
+void
+IpAddressHelperTestCasev4::DoRun (void)
+{
+ Ipv4AddressHelper ip1;
+ Ipv4Address ipAddr1;
+ ipAddr1 = ip1.NewAddress ();
+ // Ipv4AddressHelper that is unconfigured
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv4Address ("255.255.255.255"), "Ipv4AddressHelper failure");
+
+ ip1.SetBase ("192.168.0.0", "255.255.255.0");
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv4Address ("192.168.0.1"), "Ipv4AddressHelper failure");
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv4Address ("192.168.0.2"), "Ipv4AddressHelper failure");
+ ip1.NewNetwork ();
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv4Address ("192.168.1.1"), "Ipv4AddressHelper failure");
+ ip1.NewNetwork (); // 192.168.2
+ ip1.NewNetwork (); // 192.168.3
+ ip1.NewNetwork (); // 192.168.4
+ ipAddr1 = ip1.NewAddress (); // 4.1
+ ipAddr1 = ip1.NewAddress (); // 4.2
+ ipAddr1 = ip1.NewAddress (); // 4.3
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv4Address ("192.168.4.3"), "Ipv4AddressHelper failure");
+
+ // reset base to start at 192.168.0.100
+ ip1.SetBase ("192.168.0.0", "255.255.255.0", "0.0.0.100");
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv4Address ("192.168.0.100"), "Ipv4AddressHelper failure");
+
+ // rollover
+ ip1.SetBase ("192.168.0.0", "255.255.255.0", "0.0.0.254");
+ ipAddr1 = ip1.NewAddress (); // .254
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv4Address ("192.168.0.254"), "Ipv4AddressHelper failure");
+ // The below will overflow and assert, so it is commented out
+ // ipAddr1 = ip1.NewAddress (); // .255
+
+ // create with arguments
+ Ipv4AddressHelper ip2 = Ipv4AddressHelper ("192.168.1.0", "255.255.255.0", "0.0.0.1");
+ // duplicate assignment
+ ip2.NewNetwork (); // 192.168.2
+ ip2.NewNetwork (); // 192.168.3
+ ip2.NewNetwork (); // 192.168.4
+ // Uncomment below, and 192.168.4.1 will crash since it was allocated above
+ // ipAddr1 = ip2.NewAddress (); // 4.1
+
+}
+
+void
+IpAddressHelperTestCasev4::DoTeardown (void)
+{
+ Ipv4AddressGenerator::Reset ();
+ Simulator::Destroy ();
+}
+
+
static class Ipv4AddressHelperTestSuite : public TestSuite
{
public:
@@ -188,6 +264,7 @@
AddTestCase (new NetworkAllocatorHelperTestCase ());
AddTestCase (new AddressAllocatorHelperTestCase ());
AddTestCase (new ResetAllocatorHelperTestCase ());
+ AddTestCase (new IpAddressHelperTestCasev4 ());
}
} g_ipv4AddressHelperTestSuite;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/internet/test/ipv6-address-helper-test-suite.cc Tue May 29 14:13:23 2012 +0200
@@ -0,0 +1,155 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2012 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "ns3/ipv6-address-helper.h"
+#include "ns3/ipv6-address-generator.h"
+#include "ns3/ipv4-address-helper.h"
+#include "ns3/simple-net-device.h"
+#include "ns3/net-device-container.h"
+#include "ns3/node-container.h"
+#include "ns3/internet-stack-helper.h"
+#include "ns3/test.h"
+#include "ns3/log.h"
+
+using namespace ns3;
+
+class IpAddressHelperTestCasev6 : public TestCase
+{
+public:
+ IpAddressHelperTestCasev6 ();
+ virtual ~IpAddressHelperTestCasev6 ();
+
+private:
+ virtual void DoRun (void);
+ virtual void DoTeardown (void);
+};
+
+IpAddressHelperTestCasev6::IpAddressHelperTestCasev6 ()
+ : TestCase ("IpAddressHelper Ipv6 test case")
+{
+}
+
+IpAddressHelperTestCasev6::~IpAddressHelperTestCasev6 ()
+{
+}
+
+void
+IpAddressHelperTestCasev6::DoRun (void)
+{
+ Ipv6AddressHelper ip1;
+ Ipv6Address ipAddr1;
+ ipAddr1 = ip1.NewAddress ();
+ // Ipv6AddressHelper that is unconfigured
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db8::1"), "Ipv6AddressHelper failure");
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db8::2"), "Ipv6AddressHelper failure");
+ ip1.NewNetwork ();
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db8:0:1:0:0:0:1"), "Ipv6AddressHelper failure");
+
+ // Reset
+ ip1.SetBase (Ipv6Address ("2001:db81::"), Ipv6Prefix (32), Ipv6Address ("::1"));
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db81::1"), "Ipv6AddressHelper failure");
+ // Skip a few addresses
+ ip1.SetBase (Ipv6Address ("2001:db81::"), Ipv6Prefix (32), Ipv6Address ("::15"));
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db81::15"), "Ipv6AddressHelper failure");
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db81::16"), "Ipv6AddressHelper failure");
+ // Increment network
+ ip1.NewNetwork ();
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db81:0:1::15"), "Ipv6AddressHelper failure");
+ // Reset
+ ip1.SetBase (Ipv6Address ("2001:dddd::"), Ipv6Prefix (32), Ipv6Address ("::1"));
+ ipAddr1 = ip1.NewAddress (); // ::1
+ ipAddr1 = ip1.NewAddress (); // ::2
+ ipAddr1 = ip1.NewAddress (); // ::3
+ ip1.NewNetwork (); // 0:1
+ ip1.NewNetwork (); // 0:2
+ ipAddr1 = ip1.NewAddress (); // ::1 again
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:dddd:0:2::1"), "Ipv6AddressHelper failure");
+
+ // Set again
+ ip1.SetBase (Ipv6Address ("2001:db82::1"), Ipv6Prefix (32));
+ ipAddr1 = ip1.NewAddress ();
+ NS_TEST_ASSERT_MSG_EQ (ipAddr1, Ipv6Address ("2001:db82::1"), "Ipv6AddressHelper failure");
+
+ // Test container assignment
+ NodeContainer n;
+ n.Create (2);
+
+ /* Install IPv4/IPv6 stack */
+ InternetStackHelper internetv6;
+ internetv6.SetIpv4StackInstall (false);
+ internetv6.Install (n);
+
+ NetDeviceContainer d;
+ Ptr<SimpleNetDevice> s1 = CreateObject<SimpleNetDevice> ();
+ s1->SetAddress (Mac48Address::Allocate ());
+ n.Get (0)->AddDevice (s1);
+
+ Ptr<SimpleNetDevice> s2 = CreateObject<SimpleNetDevice> ();
+ s2->SetAddress (Mac48Address::Allocate ());
+ n.Get (1)->AddDevice (s2);
+ d.Add (s1);
+ d.Add (s2);
+
+ ip1.SetBase (Ipv6Address ("2001:00aa::"), Ipv6Prefix (56));
+ Ipv6InterfaceContainer ic;
+ ic = ip1.Assign (d);
+
+ // Check that d got intended addresses
+ Ipv6InterfaceAddress d1addr;
+ Ipv6InterfaceAddress d2addr;
+ // Interface 0 is loopback, interface 1 is s1, and the 0th addr is linklocal
+ // so we look at address (1,1)
+ d1addr = n.Get (0)->GetObject <Ipv6> ()->GetAddress (1, 1);
+ NS_TEST_ASSERT_MSG_EQ (d1addr.GetAddress (), Ipv6Address ("2001:00aa:0000:0000:0200:00ff:fe00:0001"), "Ipv6AddressHelper failure");
+ // Look also at the interface container (device 0, address 1)
+ NS_TEST_ASSERT_MSG_EQ (ic.GetAddress (0,1), Ipv6Address ("2001:00aa:0000:0000:0200:00ff:fe00:0001"), "Ipv6AddressHelper failure");
+ d2addr = n.Get (1)->GetObject <Ipv6> ()->GetAddress (1, 1);
+ // Look at second container
+ NS_TEST_ASSERT_MSG_EQ (d2addr.GetAddress (), Ipv6Address ("2001:00aa:0000:0000:0200:00ff:fe00:0002"), "Ipv6AddressHelper failure");
+ // Look also at the interface container (device 0, address 1)
+ NS_TEST_ASSERT_MSG_EQ (ic.GetAddress (1,1), Ipv6Address ("2001:00aa:0000:0000:0200:00ff:fe00:0002"), "Ipv6AddressHelper failure");
+}
+
+void
+IpAddressHelperTestCasev6::DoTeardown (void)
+{
+ Ipv6AddressGenerator::Reset ();
+ Simulator::Destroy ();
+}
+
+
+class Ipv6AddressHelperTestSuite : public TestSuite
+{
+public:
+ Ipv6AddressHelperTestSuite ();
+};
+
+Ipv6AddressHelperTestSuite::Ipv6AddressHelperTestSuite ()
+ : TestSuite ("ipv6-address-helper", UNIT)
+{
+ AddTestCase (new IpAddressHelperTestCasev6);
+}
+
+// Do not forget to allocate an instance of this TestSuite
+static Ipv6AddressHelperTestSuite ipv6AddressHelperTestSuite;
--- a/src/internet/wscript Tue May 29 10:42:17 2012 +0200
+++ b/src/internet/wscript Tue May 29 14:13:23 2012 +0200
@@ -8,7 +8,7 @@
import Task
# Required NSC version
-NSC_RELEASE_NAME = "nsc-0.5.2"
+NSC_RELEASE_NAME = "nsc-0.5.3"
def options(opt):
@@ -207,6 +207,7 @@
'test/ipv6-address-generator-test-suite.cc',
'test/ipv6-dual-stack-test-suite.cc',
'test/ipv6-fragmentation-test.cc',
+ 'test/ipv6-address-helper-test-suite.cc',
]
headers = bld.new_task_gen(features=['ns3header'])
--- a/src/lte/model/ff-mac-sched-sap.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/model/ff-mac-sched-sap.cc Tue May 29 14:13:23 2012 +0200
@@ -31,4 +31,4 @@
{
}
-} // namespace ns3
\ No newline at end of file
+} // namespace ns3
--- a/src/lte/model/lte-mi-error-model.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/model/lte-mi-error-model.cc Tue May 29 14:13:23 2012 +0200
@@ -248,7 +248,6 @@
{
SpectrumValue sinrCopy = sinr;
double sinrLin = sinrCopy[map.at (i)];
- double sinr_db = 10*log10 (sinrLin);
if (mcs <= 10) // QPSK
{
int tr = 0;
@@ -303,7 +302,7 @@
}
}
}
- NS_LOG_LOGIC (" RB " << map.at (i) << "Minimum SNR = " << sinr_db << " V, MCS = " << (uint16_t)mcs << ", MI = " << MI);
+ NS_LOG_LOGIC (" RB " << map.at (i) << "Minimum SNR = " << 10*log10 (sinrLin) << " V, MCS = " << (uint16_t)mcs << ", MI = " << MI);
MIsum += MI;
}
MI = MIsum / map.size ();
@@ -319,14 +318,13 @@
double b = 0;
double c = 0;
NS_ASSERT_MSG (mcs < 29, "MCS out of range [0..28]");
- int tbsIndex = TbsIndex[mcs];
int cbIndex = 1;
while ((cbIndex < 9)&&(cbMiSizeTable[cbIndex]<= cbSize))
{
cbIndex++;
}
cbIndex--;
- NS_LOG_LOGIC (" MCS " << (uint16_t)mcs << " TBS " << tbsIndex << " CB size " << cbSize << " CB size curve " << cbMiSizeTable[cbIndex]);
+ NS_LOG_LOGIC (" MCS " << (uint16_t)mcs << " TBS " << TbsIndex[mcs] << " CB size " << cbSize << " CB size curve " << cbMiSizeTable[cbIndex]);
b = bEcrTable[cbIndex][mcs];
if (b<0.0)
--- a/src/lte/model/lte-ue-cmac-sap.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/model/lte-ue-cmac-sap.cc Tue May 29 14:13:23 2012 +0200
@@ -33,4 +33,4 @@
{
}
-} // namespace ns3
\ No newline at end of file
+} // namespace ns3
--- a/src/lte/model/pf-ff-mac-scheduler.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/model/pf-ff-mac-scheduler.cc Tue May 29 14:13:23 2012 +0200
@@ -18,6 +18,10 @@
* Author: Marco Miozzo <marco.miozzo@cttc.es>
*/
+#ifdef __FreeBSD__
+#define log2(x) (log(x) / M_LN2)
+#endif /* __FreeBSD__ */
+
#include <ns3/log.h>
#include <ns3/pointer.h>
--- a/src/lte/model/rr-ff-mac-scheduler.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/model/rr-ff-mac-scheduler.cc Tue May 29 14:13:23 2012 +0200
@@ -18,6 +18,10 @@
* Author: Marco Miozzo <marco.miozzo@cttc.es>
*/
+#ifdef __FreeBSD__
+#define log2(x) (log(x) / M_LN2)
+#endif /* __FreeBSD__ */
+
#include <ns3/log.h>
#include <ns3/pointer.h>
--- a/src/lte/test/epc-test-gtpu.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/epc-test-gtpu.cc Tue May 29 14:13:23 2012 +0200
@@ -22,13 +22,13 @@
#include "ns3/log.h"
#include "ns3/object.h"
#include "ns3/packet.h"
+#include "ns3/epc-gtpu-header.h"
-#include "ns3/epc-gtpu-header.h"
-#include "ns3/epc-test-gtpu.h"
+#include "epc-test-gtpu.h"
NS_LOG_COMPONENT_DEFINE ("EpcGtpuTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -84,3 +84,6 @@
NS_TEST_ASSERT_MSG_EQ (h1, h2, "Wrong value!");
}
+
+} // namespace ns3
+
--- a/src/lte/test/epc-test-gtpu.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/epc-test-gtpu.h Tue May 29 14:13:23 2012 +0200
@@ -26,7 +26,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
@@ -50,4 +50,7 @@
};
+} // namespace ns3
+
+
#endif /* EPC_TEST_GTPU_H */
--- a/src/lte/test/lte-simple-helper.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-simple-helper.cc Tue May 29 14:13:23 2012 +0200
@@ -18,13 +18,17 @@
* Author: Manuel Requena <manuel.requena@cttc.es> (Based on lte-helper.cc)
*/
-#include "ns3/lte-simple-helper.h"
+
#include "ns3/log.h"
#include "ns3/callback.h"
#include "ns3/config.h"
#include "ns3/simple-channel.h"
#include "ns3/error-model.h"
+#include "lte-simple-helper.h"
+#include "lte-simple-net-device.h"
+#include "lte-test-entities.h"
+
NS_LOG_COMPONENT_DEFINE ("LteSimpleHelper");
--- a/src/lte/test/lte-simple-helper.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-simple-helper.h Tue May 29 14:13:23 2012 +0200
@@ -25,9 +25,7 @@
#include "ns3/simple-channel.h"
#include "ns3/node-container.h"
#include "ns3/radio-bearer-stats-calculator.h"
-#include "ns3/lte-simple-net-device.h"
-#include "ns3/lte-test-entities.h"
#include "ns3/lte-pdcp.h"
#include "ns3/lte-rlc.h"
#include "ns3/lte-rlc-um.h"
@@ -35,6 +33,8 @@
namespace ns3 {
+class LteTestRrc;
+class LteTestMac;
/**
* Creation and configuration of LTE entities
--- a/src/lte/test/lte-simple-net-device.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-simple-net-device.cc Tue May 29 14:13:23 2012 +0200
@@ -21,7 +21,7 @@
#include "ns3/simulator.h"
#include "ns3/pointer.h"
#include "ns3/log.h"
-#include "ns3/lte-simple-net-device.h"
+#include "lte-simple-net-device.h"
NS_LOG_COMPONENT_DEFINE ("LteSimpleNetDevice");
--- a/src/lte/test/lte-test-downlink-sinr.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-downlink-sinr.cc Tue May 29 14:13:23 2012 +0200
@@ -25,15 +25,16 @@
#include "ns3/spectrum-test.h"
#include "ns3/lte-phy-tag.h"
-#include "ns3/lte-test-ue-phy.h"
#include "ns3/lte-sinr-chunk-processor.h"
#include "ns3/lte-spectrum-signal-parameters.h"
-#include "ns3/lte-test-downlink-sinr.h"
+#include "lte-test-downlink-sinr.h"
+#include "lte-test-ue-phy.h"
+
NS_LOG_COMPONENT_DEFINE ("LteDownlinkSinrTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -266,3 +267,6 @@
dlPhy->Dispose ();
Simulator::Destroy ();
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-downlink-sinr.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-downlink-sinr.h Tue May 29 14:13:23 2012 +0200
@@ -26,7 +26,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -54,4 +54,7 @@
};
+
+} // namespace ns3
+
#endif /* LTE_TEST_DOWNLINK_SINR_H */
--- a/src/lte/test/lte-test-entities.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-entities.cc Tue May 29 14:13:23 2012 +0200
@@ -25,11 +25,11 @@
#include "ns3/lte-rlc-am-header.h"
#include "ns3/lte-pdcp-header.h"
-#include "ns3/lte-test-entities.h"
+#include "lte-test-entities.h"
NS_LOG_COMPONENT_DEFINE ("LteTestEntities");
-using namespace ns3;
+namespace ns3 {
/////////////////////////////////////////////////////////////////////
@@ -600,3 +600,6 @@
m_macSapUser->ReceivePdu (packet);
return true;
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-entities.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-entities.h Tue May 29 14:13:23 2012 +0200
@@ -31,8 +31,8 @@
#include "ns3/net-device.h"
-using namespace ns3;
+namespace ns3 {
/**
* This class implements a testing RRC entity
@@ -261,4 +261,6 @@
};
+} // namespace ns3
+
#endif /* LTE_TEST_MAC_H */
--- a/src/lte/test/lte-test-fading.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-fading.cc Tue May 29 14:13:23 2012 +0200
@@ -52,7 +52,7 @@
NS_LOG_COMPONENT_DEFINE ("LteFadingTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -295,3 +295,6 @@
(*outPsd1)[1] = (10 * log10 (180000*(*outPsd1)[1])) - (10 * log10 (180000*(*inPsd1)[1]));
m_fadingSamples.push_back ((*outPsd1));
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-fading.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-fading.h Tue May 29 14:13:23 2012 +0200
@@ -31,7 +31,7 @@
#include <ns3/trace-fading-loss-model.h>
-using namespace ns3;
+namespace ns3 {
/**
@@ -83,4 +83,7 @@
uint16_t m_mcsIndex;
};
+} // namespace ns3
+
+
#endif /*LTE_TEST_FADING_H*/
--- a/src/lte/test/lte-test-interference.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-interference.cc Tue May 29 14:13:23 2012 +0200
@@ -34,13 +34,13 @@
#include "ns3/lte-ue-phy.h"
#include "ns3/lte-ue-net-device.h"
-#include "ns3/lte-test-interference.h"
+#include "lte-test-interference.h"
#include "lte-test-sinr-chunk-processor.h"
NS_LOG_COMPONENT_DEFINE ("LteInterferenceTest");
-using namespace ns3;
+namespace ns3 {
void
@@ -252,3 +252,6 @@
NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcs, m_ulMcs, "Wrong UL MCS");
}
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-interference.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-interference.h Tue May 29 14:13:23 2012 +0200
@@ -25,7 +25,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -65,4 +65,7 @@
};
+} // namespace ns3
+
+
#endif /* LTE_TEST_INTERFERENCE_H */
--- a/src/lte/test/lte-test-link-adaptation.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-link-adaptation.cc Tue May 29 14:13:23 2012 +0200
@@ -30,13 +30,13 @@
#include "ns3/lte-ue-phy.h"
#include "ns3/lte-ue-net-device.h"
-#include "ns3/lte-test-link-adaptation.h"
+#include "lte-test-link-adaptation.h"
#include "lte-test-sinr-chunk-processor.h"
NS_LOG_COMPONENT_DEFINE ("LteLinkAdaptationTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -239,3 +239,6 @@
NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcsTb1, m_mcsIndex, "Wrong MCS index");
}
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-link-adaptation.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-link-adaptation.h Tue May 29 14:13:23 2012 +0200
@@ -24,7 +24,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -56,4 +56,7 @@
};
+} // namespace ns3
+
+
#endif /* LTE_TEST_LINK_ADAPTATION_H */
--- a/src/lte/test/lte-test-mimo.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-mimo.cc Tue May 29 14:13:23 2012 +0200
@@ -34,7 +34,6 @@
#include "ns3/radio-bearer-stats-calculator.h"
#include <ns3/buildings-mobility-model.h>
#include <ns3/buildings-propagation-loss-model.h>
-#include "ns3/lte-test-mimo.h"
#include <ns3/eps-bearer.h>
#include <ns3/node-container.h>
#include <ns3/mobility-helper.h>
@@ -53,10 +52,12 @@
#include <ns3/pointer.h>
#include <ns3/enum.h>
+#include "lte-test-mimo.h"
+
NS_LOG_COMPONENT_DEFINE ("LenaTestMimo");
-using namespace ns3;
+namespace ns3 {
LenaTestMimoSuite::LenaTestMimoSuite ()
@@ -284,3 +285,6 @@
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-mimo.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-mimo.h Tue May 29 14:13:23 2012 +0200
@@ -25,7 +25,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -64,4 +64,7 @@
+} // namespace ns3
+
+
#endif /* LENA_TEST_MIMO_H */
--- a/src/lte/test/lte-test-pathloss-model.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-pathloss-model.cc Tue May 29 14:13:23 2012 +0200
@@ -25,10 +25,9 @@
#include "ns3/spectrum-test.h"
#include "ns3/lte-phy-tag.h"
-#include "ns3/lte-test-ue-phy.h"
#include "ns3/lte-sinr-chunk-processor.h"
-#include "ns3/lte-test-pathloss-model.h"
+
#include <ns3/hybrid-buildings-propagation-loss-model.h>
#include <ns3/node-container.h>
#include <ns3/mobility-helper.h>
@@ -45,11 +44,14 @@
#include <ns3/lte-helper.h>
#include <ns3/lte-enb-phy.h>
#include <ns3/lte-ue-phy.h>
-#include <ns3/lte-test-sinr-chunk-processor.h>
+
+#include "lte-test-sinr-chunk-processor.h"
+#include "lte-test-ue-phy.h"
+#include "lte-test-pathloss-model.h"
NS_LOG_COMPONENT_DEFINE ("LtePathlossModelTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -310,3 +312,6 @@
}
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-pathloss-model.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-pathloss-model.h Tue May 29 14:13:23 2012 +0200
@@ -29,7 +29,7 @@
#include <ns3/buildings-propagation-loss-model.h>
-using namespace ns3;
+namespace ns3 {
/**
@@ -61,5 +61,8 @@
};
+} // namespace ns3
+
+
#endif /* LTE_TEST_PATHLOSS_MODEL_H */
--- a/src/lte/test/lte-test-pf-ff-mac-scheduler.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-pf-ff-mac-scheduler.cc Tue May 29 14:13:23 2012 +0200
@@ -33,7 +33,6 @@
#include <ns3/ptr.h>
#include "ns3/radio-bearer-stats-calculator.h"
#include <ns3/constant-position-mobility-model.h>
-#include "ns3/lte-test-pf-ff-mac-scheduler.h"
#include <ns3/eps-bearer.h>
#include <ns3/node-container.h>
#include <ns3/mobility-helper.h>
@@ -49,10 +48,11 @@
#include <ns3/boolean.h>
#include <ns3/enum.h>
+#include "lte-test-pf-ff-mac-scheduler.h"
NS_LOG_COMPONENT_DEFINE ("LenaTestPfFfMacCheduler");
-using namespace ns3;
+namespace ns3 {
LenaTestPfFfMacSchedulerSuite::LenaTestPfFfMacSchedulerSuite ()
: TestSuite ("lte-pf-ff-mac-scheduler", SYSTEM)
@@ -535,5 +535,8 @@
}
+} // namespace ns3
+
+
--- a/src/lte/test/lte-test-pf-ff-mac-scheduler.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-pf-ff-mac-scheduler.h Tue May 29 14:13:23 2012 +0200
@@ -26,7 +26,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -82,4 +82,7 @@
+} // namespace ns3
+
+
#endif /* LENA_TEST_PF_FF_MAC_SCHEDULER_H */
--- a/src/lte/test/lte-test-phy-error-model.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-phy-error-model.cc Tue May 29 14:13:23 2012 +0200
@@ -30,7 +30,6 @@
#include <ns3/radio-bearer-stats-calculator.h>
#include <ns3/buildings-mobility-model.h>
#include <ns3/hybrid-buildings-propagation-loss-model.h>
-#include "ns3/lte-test-phy-error-model.h"
#include <ns3/eps-bearer.h>
#include <ns3/node-container.h>
#include <ns3/mobility-helper.h>
@@ -48,10 +47,11 @@
#include <ns3/enum.h>
#include <ns3/unused.h>
+#include "lte-test-phy-error-model.h"
NS_LOG_COMPONENT_DEFINE ("LenaTestPhyErrorModel");
-using namespace ns3;
+namespace ns3 {
LenaTestPhyErrorModelrSuite::LenaTestPhyErrorModelrSuite ()
@@ -257,3 +257,6 @@
Simulator::Destroy ();
}
+} // namespace ns3
+
+
--- a/src/lte/test/lte-test-phy-error-model.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-phy-error-model.h Tue May 29 14:13:23 2012 +0200
@@ -25,7 +25,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -63,4 +63,7 @@
+} // namespace ns3
+
+
#endif /* LENA_TEST_PHY_ERROR_MODEL_H */
--- a/src/lte/test/lte-test-rlc-am-e2e.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-am-e2e.cc Tue May 29 14:13:23 2012 +0200
@@ -25,23 +25,20 @@
#include "ns3/packet.h"
#include "ns3/node-container.h"
#include "ns3/net-device-container.h"
-#include "ns3/lte-simple-helper.h"
#include "ns3/error-model.h"
-
#include "ns3/radio-bearer-stats-calculator.h"
-
#include "ns3/lte-rlc-header.h"
#include "ns3/lte-rlc-um.h"
+#include "ns3/config-store.h"
-#include "ns3/lte-test-entities.h"
-#include "ns3/lte-test-rlc-am-e2e.h"
-
-#include "ns3/config-store.h"
+#include "lte-test-rlc-am-e2e.h"
+#include "lte-simple-helper.h"
+#include "lte-test-entities.h"
NS_LOG_COMPONENT_DEFINE ("LteRlcAmE2eTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -214,3 +211,6 @@
Simulator::Destroy ();
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-rlc-am-e2e.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-am-e2e.h Tue May 29 14:13:23 2012 +0200
@@ -24,7 +24,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -58,4 +58,7 @@
};
+} // namespace ns3
+
+
#endif // LTE_TEST_RLC_AM_E2E_H
--- a/src/lte/test/lte-test-rlc-am-transmitter.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-am-transmitter.cc Tue May 29 14:13:23 2012 +0200
@@ -24,11 +24,12 @@
#include "ns3/lte-rlc-header.h"
#include "ns3/lte-rlc-am.h"
-#include "ns3/lte-test-rlc-am-transmitter.h"
+#include "lte-test-rlc-am-transmitter.h"
+#include "lte-test-entities.h"
NS_LOG_COMPONENT_DEFINE ("LteRlcAmTransmitterTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -296,3 +297,6 @@
Simulator::Run ();
Simulator::Destroy ();
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-rlc-am-transmitter.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-am-transmitter.h Tue May 29 14:13:23 2012 +0200
@@ -23,10 +23,12 @@
#include "ns3/test.h"
-#include "ns3/lte-test-entities.h"
+
+namespace ns3 {
-using namespace ns3;
-
+class LteTestRrc;
+class LteTestMac;
+class LteTestPdcp;
/**
* TestSuite 4.1.1 RLC AM: Only transmitter
@@ -118,4 +120,6 @@
};
+} // namespace ns3
+
#endif // LTE_TEST_RLC_AM_TRANSMITTER_H
--- a/src/lte/test/lte-test-rlc-um-e2e.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-um-e2e.cc Tue May 29 14:13:23 2012 +0200
@@ -25,20 +25,19 @@
#include "ns3/packet.h"
#include "ns3/node-container.h"
#include "ns3/net-device-container.h"
-#include "ns3/lte-simple-helper.h"
#include "ns3/error-model.h"
#include "ns3/radio-bearer-stats-calculator.h"
-
#include "ns3/lte-rlc-header.h"
#include "ns3/lte-rlc-um.h"
-#include "ns3/lte-test-entities.h"
-#include "ns3/lte-test-rlc-um-e2e.h"
+#include "lte-simple-helper.h"
+#include "lte-test-entities.h"
+#include "lte-test-rlc-um-e2e.h"
NS_LOG_COMPONENT_DEFINE ("LteRlcUmE2eTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -224,3 +223,6 @@
Simulator::Destroy ();
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-rlc-um-e2e.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-um-e2e.h Tue May 29 14:13:23 2012 +0200
@@ -24,7 +24,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -58,4 +58,7 @@
};
+} // namespace ns3
+
+
#endif // LTE_TEST_RLC_UM_E2E_H
--- a/src/lte/test/lte-test-rlc-um-transmitter.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-um-transmitter.cc Tue May 29 14:13:23 2012 +0200
@@ -24,11 +24,12 @@
#include "ns3/lte-rlc-header.h"
#include "ns3/lte-rlc-um.h"
-#include "ns3/lte-test-rlc-um-transmitter.h"
+#include "lte-test-rlc-um-transmitter.h"
+#include "lte-test-entities.h"
NS_LOG_COMPONENT_DEFINE ("LteRlcUmTransmitterTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -298,3 +299,6 @@
Simulator::Destroy ();
}
+} // namespace ns3
+
+
--- a/src/lte/test/lte-test-rlc-um-transmitter.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rlc-um-transmitter.h Tue May 29 14:13:23 2012 +0200
@@ -23,10 +23,12 @@
#include "ns3/test.h"
-#include "ns3/lte-test-entities.h"
+
+namespace ns3 {
-using namespace ns3;
-
+class LteTestRrc;
+class LteTestMac;
+class LteTestPdcp;
/**
* TestSuite 4.1.1 RLC UM: Only transmitter
@@ -118,4 +120,6 @@
};
+} // namespace ns3
+
#endif /* LTE_TEST_RLC_UM_TRANSMITTER_H */
--- a/src/lte/test/lte-test-rr-ff-mac-scheduler.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rr-ff-mac-scheduler.cc Tue May 29 14:13:23 2012 +0200
@@ -29,7 +29,6 @@
#include <iostream>
#include "ns3/radio-bearer-stats-calculator.h"
#include <ns3/constant-position-mobility-model.h>
-#include "ns3/lte-test-rr-ff-mac-scheduler.h"
#include <ns3/eps-bearer.h>
#include <ns3/node-container.h>
#include <ns3/mobility-helper.h>
@@ -45,10 +44,11 @@
#include <ns3/boolean.h>
#include <ns3/enum.h>
+#include "lte-test-rr-ff-mac-scheduler.h"
NS_LOG_COMPONENT_DEFINE ("LenaTestRrFfMacCheduler");
-using namespace ns3;
+namespace ns3 {
LenaTestRrFfMacSchedulerSuite::LenaTestRrFfMacSchedulerSuite ()
@@ -324,3 +324,6 @@
Simulator::Destroy ();
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-rr-ff-mac-scheduler.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-rr-ff-mac-scheduler.h Tue May 29 14:13:23 2012 +0200
@@ -25,7 +25,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -64,5 +64,8 @@
+} // namespace ns3
+
+
#endif /* LENA_TEST_RR_FF_MAC_SCHEDULER_H */
--- a/src/lte/test/lte-test-ue-phy.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-ue-phy.cc Tue May 29 14:13:23 2012 +0200
@@ -19,7 +19,7 @@
*/
#include "ns3/log.h"
-#include "ns3/lte-test-ue-phy.h"
+#include "lte-test-ue-phy.h"
NS_LOG_COMPONENT_DEFINE ("LteTestUePhy");
--- a/src/lte/test/lte-test-uplink-sinr.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-uplink-sinr.cc Tue May 29 14:13:23 2012 +0200
@@ -25,15 +25,15 @@
#include "ns3/spectrum-test.h"
#include "ns3/lte-phy-tag.h"
-#include "ns3/lte-test-ue-phy.h"
#include "ns3/lte-sinr-chunk-processor.h"
#include "ns3/lte-spectrum-signal-parameters.h"
-#include "ns3/lte-test-uplink-sinr.h"
+#include "lte-test-ue-phy.h"
+#include "lte-test-uplink-sinr.h"
NS_LOG_COMPONENT_DEFINE ("LteUplinkSinrTest");
-using namespace ns3;
+namespace ns3 {
/**
@@ -307,3 +307,6 @@
Simulator::Destroy ();
}
+
+} // namespace ns3
+
--- a/src/lte/test/lte-test-uplink-sinr.h Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/lte-test-uplink-sinr.h Tue May 29 14:13:23 2012 +0200
@@ -26,7 +26,7 @@
#include "ns3/test.h"
-using namespace ns3;
+namespace ns3 {
/**
@@ -56,3 +56,6 @@
#endif /* LTE_TEST_UPLINK_SINR_H */
+
+} // namespace ns3
+
--- a/src/lte/test/test-lte-antenna.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/test/test-lte-antenna.cc Tue May 29 14:13:23 2012 +0200
@@ -36,7 +36,7 @@
NS_LOG_COMPONENT_DEFINE ("LteAntennaTest");
-using namespace ns3;
+namespace ns3 {
@@ -221,3 +221,7 @@
}
static LteAntennaTestSuite lteAntennaTestSuite;
+
+
+} // namespace ns3
+
--- a/src/lte/wscript Tue May 29 10:42:17 2012 +0200
+++ b/src/lte/wscript Tue May 29 14:13:23 2012 +0200
@@ -157,28 +157,9 @@
'model/epc-gtpu-header.h',
'model/epc-enb-application.h',
'model/epc-sgw-pgw-application.h',
- 'test/lte-test-downlink-sinr.h',
- 'test/lte-test-uplink-sinr.h',
- 'test/lte-test-link-adaptation.h',
- 'test/lte-test-interference.h',
- 'test/lte-test-sinr-chunk-processor.h',
- 'test/lte-test-ue-phy.h',
- 'test/lte-test-rr-ff-mac-scheduler.h',
- 'test/lte-test-pf-ff-mac-scheduler.h',
- 'test/lte-test-phy-error-model.h',
- 'test/lte-test-pathloss-model.h',
- 'test/epc-test-gtpu.h',
- 'test/lte-test-entities.h',
- 'test/lte-simple-net-device.h',
- 'test/lte-simple-helper.h',
- 'test/lte-test-rlc-um-transmitter.h',
- 'test/lte-test-rlc-am-transmitter.h',
- 'test/lte-test-rlc-um-e2e.h',
- 'test/lte-test-rlc-am-e2e.h',
'model/epc-tft.h',
'model/epc-tft-classifier.h',
'model/lte-mi-error-model.h',
- 'test/lte-test-mimo.h'
]
if (bld.env['ENABLE_EXAMPLES']):
--- a/src/mesh/model/dot11s/peer-management-protocol.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/mesh/model/dot11s/peer-management-protocol.cc Tue May 29 14:13:23 2012 +0200
@@ -242,7 +242,7 @@
void
PeerManagementProtocol::TransmissionFailure (uint32_t interface, Mac48Address peerAddress)
{
- NS_LOG_DEBUG ("transmission failed between "<<GetAddress () << " and " << peerAddress << " failed, link will be colsed");
+ NS_LOG_DEBUG ("transmission failed between "<<GetAddress () << " and " << peerAddress << " failed, link will be closed");
Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
if (peerLink != 0)
{
@@ -252,7 +252,7 @@
void
PeerManagementProtocol::TransmissionSuccess (uint32_t interface, Mac48Address peerAddress)
{
- NS_LOG_DEBUG ("transmission success "<<GetAddress () << " and " << peerAddress << " failed, link will be colsed");
+ NS_LOG_DEBUG ("transmission success "<< GetAddress () << " and " << peerAddress);
Ptr<PeerLink> peerLink = FindPeerLink (interface, peerAddress);
if (peerLink != 0)
{
Binary file src/netanim/doc/animation-dumbbell.png has changed
--- a/src/netanim/doc/animation.rst Tue May 29 10:42:17 2012 +0200
+++ b/src/netanim/doc/animation.rst Tue May 29 14:13:23 2012 +0200
@@ -7,20 +7,44 @@
contain a default graphical animation tool, we currently have two ways to provide
animation, namely using the PyViz method or the NetAnim method.
The PyViz method is described in http://www.nsnam.org/wiki/index.php/PyViz.
-The NetAnim method is described in detail at http://www.nsnam.org/wiki/index.php/NetAnim.
+
We will describe the NetAnim method briefly here.
NetAnim
*******
NetAnim is a standalone, Qt4-based software executable that uses a trace file generated during
-an |ns-3| simulation to display the topology and animate the packet flow between nodes.
+an |ns3| simulation to display the topology and animate the packet flow between nodes.
+
+.. figure:: figures/Dumbbell.*
+ :align: center
+ :width: 500px
+ :height: 400px
-.. _anim-dumbbell:
+ An example of packet animation on wired-links
+
+.. figure:: figures/Wireless.*
+ :align: center
+ :width: 480px
+ :height: 400px
+
+ An example of packet animation on wireless-links
-.. figure:: figures/animation-dumbbell.*
+In addition, NetAnim also provides useful features such as tables to display meta-data of packets like the image below
+
+.. figure:: figures/PacketStatistics.*
+ :align: center
+ :width: 500px
+
+ An example of tables for packet meta-data with protocol filters
- NetAnim GUI with dumbbell animation.
+and a way to visualize the trajectory of a mobile node
+
+.. figure:: figures/Trajectory.*
+ :align: center
+ :width: 500px
+
+ An example of the trajectory of a mobile node
Methodology
===========
@@ -35,13 +59,12 @@
Downloading NetAnim
===================
-If NetAnim is not already available in the |ns-3| package you downloaded, you can do the following
+If NetAnim is not already available in the |ns3| package you downloaded, you can do the following:
Please ensure that you have installed mercurial.
-The latest version of NetAnim can be downloaded using mercurial with the following command
-::
- hg clone http://code.nsnam.org/jabraham3/netanim
+The latest version of NetAnim can be downloaded using mercurial with the following command::
+ hg clone http://code.nsnam.org/netanim
Building NetAnim
================
@@ -49,46 +72,44 @@
~~~~~~~~~~~~~
Qt4 (4.7 and over) is required to build NetAnim. This can be obtained using the following ways:
-For Debian/Ubuntu Linux distributions
-::
- apt-get install qt4-dev-tools
+For Debian/Ubuntu Linux distributions::
+
+ apt-get install qt4-dev-tools
+
+For Red Hat/Fedora based distribution::
-For Red Hat/Fedora based distribution
-::
- yum install qt4
- yum install qt4-devel
+ yum install qt4
+ yum install qt4-devel
-For Mac/OSX
-::
- http://qt.nokia.com/downloads/
+For Mac/OSX::
+
+ http://qt.nokia.com/downloads/
Build steps
~~~~~~~~~~~
-To build NetAnim use the following commands
-::
+To build NetAnim use the following commands::
+
cd netanim
make clean
qmake NetAnim.pro (For MAC Users: qmake -spec macx-g++ NetAnim.pro)
make
- Note: qmake could be "qmake-qt4" in some systems
+Note: qmake could be "qmake-qt4" in some systems
-This should create an executable named "NetAnim" in the same directory
-::
+This should create an executable named "NetAnim" in the same directory::
+
john@john-VirtualBox:~/netanim$ ls -l NetAnim
-rwxr-xr-x 1 john john 390395 2012-05-22 08:32 NetAnim
-
Usage
=====
Using NetAnim is a two-step process
-Step 1: Generate the animation XML trace file during simulation using "ns3::AnimationInterface"
- in the |ns-3| code base.
-Step 2: Load the XML trace file generated in Step 1 with the offline Qt4-based animator (NetAnim).
+Step 1:Generate the animation XML trace file during simulation using "ns3::AnimationInterface" in the |ns3| code base.
+Step 2:Load the XML trace file generated in Step 1 with the offline Qt4-based animator named NetAnim.
Step 1: Generate XML animation trace file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -96,10 +117,11 @@
to construct a timestamped ASCII file in XML format.
Examples are found under src/netanim/examples
-Example
-::
+Example::
+
./waf -d debug configure --enable-examples
./waf --run "dumbbell-animation"
+
The above will create an XML file dumbbell-animation.xml
Mandatory
@@ -108,32 +130,39 @@
1. Ensure that your program's wscript includes the "netanim" module. An example of such a wscript is at src/netanim/examples/wscript.
2. Include the header [#include "ns3/netanim-module.h"] in your test program
3. Add the statement
+
::
+
AnimationInterface anim ("animation.xml");
- where "animation.xml" is any arbitrary filename
-
+ where "animation.xml" is any arbitrary filename
[for versions before ns-3.13 you also have to use the line "anim.SetXMLOutput() to set the XML mode and also use anim.StartAnimation();]
Optional
########
-The following are optional but useful steps
-::
+The following are optional but useful steps::
+
1.anim.SetMobilityPollInterval (Seconds (1));
AnimationInterface records the position of all nodes every 250 ms by default. The statement above sets
the periodic interval at which AnimationInterface records the position of all nodes. If the nodes are
-expected to move very little, it is useful to set a high mobility interval to avoid large XML files.
+expected to move very little, it is useful to set a high mobility poll interval to avoid large XML files.
+
::
+
2. anim.SetConstantPosition (Ptr< Node > n, double x, double y);
-AnimationInterface requires that the position of all nodes be set. In ns-3 this is done by setting an associated MobilityModel. "SetConstantPosition" is a quick way to set the x-y coordinates of a node which is stationary.
+AnimationInterface requires that the position of all nodes be set. In |ns3| this is done by setting an associated MobilityModel. "SetConstantPosition" is a quick way to set the x-y coordinates of a node which is stationary.
+
::
+
3. anim.SetStartTime (Seconds(150)); and anim.SetStopTime (Seconds(150));
AnimationInterface can generate large XML files. The above statements restricts the window between which AnimationInterface does tracing. Restricting the window serves to focus only on relevant portions of the simulation and creating manageably small XML files
+
::
+
4. AnimationInterface anim ("animation.xml", 50000);
Using the above constructor ensures that each animation XML trace file has only 50000 packets. For example, if AnimationInterface captures 150000 packets, using the above constructor splits the capture into 3 files
@@ -143,10 +172,13 @@
animation.xml-1 - containing the packet range 50001-100000
animation.xml-2 - containing the packet range 100001-150000
+
::
+
5. anim.EnablePacketMetadata (true);
With the above statement, AnimationInterface records the meta-data of each packet in the xml trace file. Metadata can be used by NetAnim to provide better statistics and filter, along with providing some brief information about the packet such as TCP sequence number or source & destination IP address during packet animation.
+
CAUTION: Enabling this feature will result in larger XML trace files.
Please do NOT enable this feature when using Wimax links.
@@ -157,34 +189,78 @@
2. When NetAnim is opened, click on the File open button at the top-left corner, select the XML file generated during Step 1.
3. Hit the green play button to begin animation.
+Here is a video illustrating this
+http://www.youtube.com/watch?v=tz_hUuNwFDs
+
Essential settings of NetAnim
=============================
Persist combobox
~~~~~~~~~~~~~~~~
+.. figure:: figures/Persist.*
+ :width: 150px
+
+ The persist combobox
+
When packets are transmitted and received very quickly, they can be almost invisible. The persist time setting
allows the user to control the duration for which a packet should be visible on the animation canvas.
Fast-forward button
~~~~~~~~~~~~~~~~~~~
+.. figure:: figures/FastForward.*
+ :width: 50px
+
+ The Fast-forward button
+
This setting is ON by default. With this setting ON, the animation progresses in simulation time rather than
wall-clock time. This means, if there were three intervals of time, A to B , B to C and C to D, and if all packets are transmitted and received only in the intervals A to B and C to D , while B to C is a
20 second idle period with no packet tranmission or reception or node mobility, NetAnim will skip over B to C, instantly without waiting for 20 seconds. The user can turn OFF Fast-forward when they want the animation to proceed like wall-clock time.
Update-interval slider
~~~~~~~~~~~~~~~~~~~~~~
+.. figure:: figures/UpdateRateInterval.*
+ :width: 150px
+
+ The update-interval slider
+
If Fast-forward (discussed above) is turned OFF, the update-interval slider controls the rate at which
-NetAnim refreshes the canvas screen.
+NetAnim refreshes the canvas screen. For instance, for the setting above, NetAnim, updates the position
+of nodes and packets only once in 250 ms.
Precision button
~~~~~~~~~~~~~~~~
+.. figure:: figures/Precision.*
+ :width: 50px
+
+ The precision button
+
This setting is turned OFF by default. When using purely point-to-point topologies precision can be turned ON,
to distinguish between small and large packets travelling on a link. For instance a small packet such as a
-TCP ACK segment occupies only a small fraction of the length of the link , which provides a realistic animation
+TCP ACK segment occupies only a small fraction of the length of the link , which provides a realistic animation.
+
CAUTION: Precision should be turned ON only for completely point-to-point topologies.
+The below two images show the difference between packet link animation for the case without precision and for the
+case with precision. The one with precision ON, shows that the SYN segment does not occupy the full link, because
+they are small packets. This is provides a better visualization.
+
+.. figure:: figures/WithoutPrecision.*
+ :width: 150px
+
+ Without precision
+
+.. figure:: figures/WithPrecision.*
+ :width: 150px
+
+ With precision
+
Sim-time spinbox
~~~~~~~~~~~~~~~~
+.. figure:: figures/SimTime.*
+ :width: 150px
+
+ The Sim-time spinbox
+
The Sim-time spinbox can be used to go forward or backward in simulation time.
@@ -205,80 +281,91 @@
1. <anim> element
-This is the XML root element. All other elements fall within this element
- Attributes are:
- lp = Logical Processor Id (Used for distributed simulations only)
+This is the XML root element. All other elements fall within this element.
+ Attributes are::
+
+ lp = Logical Processor Id (Used for distributed simulations only)
2. <topology> element
This elements contains the Node and Link elements.It describes, the co-ordinates of the canvas used for animation.
- Attributes are:
- minX = minimum X coordinate of the animation canvas
- minY = minimum Y coordinate of the animation canvas
- maxX = maximum X coordinate of the animation canvas
- maxY = maximum Y coordinate of the animation canvas
+ Attributes are::
-Example
-::
+ minX = minimum X coordinate of the animation canvas
+ minY = minimum Y coordinate of the animation canvas
+ maxX = maximum X coordinate of the animation canvas
+ maxY = maximum Y coordinate of the animation canvas
+
+Example::
+
<topology minX = "-6.42025" minY = "-6.48444" maxX = "186.187" maxY = "188.049">
3. <node> element
-This element describes each Node's Id and X,Y co-ordinate (position)
- Attributes are:
+This element describes each Node's Id and X,Y co-ordinate (position).
+ Attributes are::
+
id = Node Id
locX = X coordinate
locY = Y coordinate
-Example
-::
+Example::
+
<node id = "8" locX = "107.599" locY = "96.9366" />
4. <link> element
This element describes wired links between two nodes.
- Attributes are:
+ Attributes are::
+
fromId = From Node Id (first node id)
toId = To Node Id (second node id)
-Example
-::
+Example::
+
<link fromId="0" toId="1"/>
5. <packet> element
-This element describes a packet over wired links being transmitted at some node and received at another. The reception details are described in its associated rx element
- Attributes are:
+This element describes a packet over wired links being transmitted at some node and received at another.
+
+The reception details are described in its associated rx element
+ Attributes are::
+
fromId = Node Id transmitting the packet
fbTx = First bit transmit time of the packet
lbTx = Last bit transmit time of the packet
-Example
-::
+Example::
+
<packet fromId="1" fbTx="1" lbTx="1.000067199"><rx toLp="0" toId="0" fbRx="1.002" lbRx="1.002067199"/>
-A packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1th second, the last bit was transmitted at the 1.000067199th second of the simulation Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation
+A packet over wired-links from Node 1 was received at Node 0. The first bit of the packet was transmitted at the 1st second, the last bit was transmitted at the 1.000067199th second of the simulation Node 0 received the first bit of the packet at the 1.002th second and the last bit of the packet at the 1.002067199th second of the simulation
NOTE: A packet with fromId == toId is a dummy packet used internally by the AnimationInterface. Please ignore this packet
6. <rx> element
-This element describes the reception of a packet at a node
- Attributes are:
+This element describes the reception of a packet at a node.
+ Attributes are::
+
toId = Node Id receiving the packet
fbRx = First bit Reception Time of the packet
lbRx = Last bit Reception Time of the packet
7. <wpacket> element
-This element describes a packet over wireless links being transmitted at some node and received at another. The reception details are described in its associated rx element
- Attributes are:
+This element describes a packet over wireless links being transmitted at some node and received at another.
+
+The reception details are described in its associated rx element.
+ Attributes are::
+
fromId = Node Id transmitting the packet
fbTx = First bit transmit time of the packet
lbTx = Last bit transmit time of the packet
range = Range of the transmission
-Example
-::
+Example::
+
<wpacket fromId = "20" fbTx = "0.003" lbTx = "0.003254" range = "59.68176982">
<rx toLp="0" toId="32" fbRx="0.003000198" lbRx="0.003254198"/>
Binary file src/netanim/doc/figures/Dumbbell.pdf has changed
Binary file src/netanim/doc/figures/Dumbbell.png has changed
Binary file src/netanim/doc/figures/FastForward.pdf has changed
Binary file src/netanim/doc/figures/FastForward.png has changed
Binary file src/netanim/doc/figures/PacketStatistics.pdf has changed
Binary file src/netanim/doc/figures/PacketStatistics.png has changed
Binary file src/netanim/doc/figures/PacketStats.png has changed
Binary file src/netanim/doc/figures/Persist.pdf has changed
Binary file src/netanim/doc/figures/Persist.png has changed
Binary file src/netanim/doc/figures/Precision.pdf has changed
Binary file src/netanim/doc/figures/Precision.png has changed
Binary file src/netanim/doc/figures/SimTime.pdf has changed
Binary file src/netanim/doc/figures/SimTime.png has changed
Binary file src/netanim/doc/figures/Trajectory.pdf has changed
Binary file src/netanim/doc/figures/Trajectory.png has changed
Binary file src/netanim/doc/figures/UpdateRateInterval.pdf has changed
Binary file src/netanim/doc/figures/UpdateRateInterval.png has changed
Binary file src/netanim/doc/figures/Wireless.pdf has changed
Binary file src/netanim/doc/figures/Wireless.png has changed
Binary file src/netanim/doc/figures/WithPrecision.pdf has changed
Binary file src/netanim/doc/figures/WithPrecision.png has changed
Binary file src/netanim/doc/figures/WithoutPrecision.pdf has changed
Binary file src/netanim/doc/figures/WithoutPrecision.png has changed
--- a/src/netanim/examples/dumbbell-animation.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/netanim/examples/dumbbell-animation.cc Tue May 29 14:13:23 2012 +0200
@@ -100,9 +100,8 @@
// Set up the acutal simulation
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
- std::cout << "Running the simulation" << std::endl;
Simulator::Run ();
- std::cout << "Destroying the simulation" << std::endl;
+ std::cout << "Animation Trace file created:" << animFile.c_str ()<< std::endl;
Simulator::Destroy ();
return 0;
}
--- a/src/netanim/examples/grid-animation.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/netanim/examples/grid-animation.cc Tue May 29 14:13:23 2012 +0200
@@ -88,11 +88,7 @@
// Set up the actual simulation
Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
- std::cout << "Running the simulation" << std::endl;
Simulator::Run ();
- std::cout << "Destroying the simulation" << std::endl;
Simulator::Destroy ();
- std::cout << "Stopping the animation" << std::endl;
- anim.StopAnimation ();
return 0;
}
--- a/src/netanim/model/animation-interface.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/netanim/model/animation-interface.cc Tue May 29 14:13:23 2012 +0200
@@ -35,6 +35,8 @@
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-mac.h"
#include "ns3/constant-position-mobility-model.h"
+#include "ns3/lte-ue-phy.h"
+#include "ns3/lte-enb-phy.h"
#include <stdio.h>
#include <unistd.h>
@@ -44,14 +46,6 @@
#include <iomanip>
#include <map>
-// Socket related includes
-#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H)
-#include <sys/socket.h>
-#include <netinet/in.h>
-#else
-#include <fcntl.h>
-#endif
-
NS_LOG_COMPONENT_DEFINE ("AnimationInterface");
@@ -62,22 +56,10 @@
static bool initialized = false;
std::map <uint32_t, std::string> AnimationInterface::nodeDescriptions;
-AnimationInterface::AnimationInterface ()
- : m_fHandle (STDOUT_FILENO), m_xml (false), m_mobilityPollInterval (Seconds(0.25)),
- m_usingSockets (false), m_port (0), m_outputFileName (""),
- m_outputFileSet (false), m_serverPortSet (false), gAnimUid (0),m_randomPosition (true),
- m_writeCallback (0), m_started (false),
- m_enablePacketMetadata (false), m_startTime (Seconds(0)), m_stopTime (Seconds(3600 * 1000)),
- m_maxPktsPerFile (MAX_PKTS_PER_TRACE_FILE)
-{
- initialized = true;
- StartAnimation ();
-}
-
AnimationInterface::AnimationInterface (const std::string fn, uint64_t maxPktsPerFile, bool usingXML)
- : m_fHandle (STDOUT_FILENO), m_xml (usingXML), m_mobilityPollInterval (Seconds(0.25)),
- m_usingSockets (false), m_port (0), m_outputFileName (fn),
- m_outputFileSet (false), m_serverPortSet (false), gAnimUid (0), m_randomPosition (true),
+ : m_xml (usingXML), m_mobilityPollInterval (Seconds(0.25)),
+ m_outputFileName (fn),
+ m_outputFileSet (false), gAnimUid (0), m_randomPosition (true),
m_writeCallback (0), m_started (false),
m_enablePacketMetadata (false), m_startTime (Seconds(0)), m_stopTime (Seconds(3600 * 1000)),
m_maxPktsPerFile (maxPktsPerFile), m_originalFileName (fn)
@@ -86,18 +68,6 @@
StartAnimation ();
}
-AnimationInterface::AnimationInterface (const uint16_t port, bool usingXML)
- : m_fHandle (STDOUT_FILENO), m_xml (usingXML), m_mobilityPollInterval (Seconds(0.25)),
- m_usingSockets (true), m_port (port), m_outputFileName (""),
- m_outputFileSet (false), m_serverPortSet (false), gAnimUid (0), m_randomPosition (true),
- m_writeCallback (0), m_started (false),
- m_enablePacketMetadata (false), m_startTime (Seconds(0)), m_stopTime (Seconds(3600 * 1000)),
- m_maxPktsPerFile (MAX_PKTS_PER_TRACE_FILE)
-{
- initialized = true;
- StartAnimation ();
-}
-
AnimationInterface::~AnimationInterface ()
{
StopAnimation ();
@@ -142,21 +112,13 @@
{
return true;
}
- if (fn == "")
- {
- m_fHandle = STDOUT_FILENO;
- m_outputFileSet = true;
- return true;
- }
NS_LOG_INFO ("Creating new trace file:" << fn.c_str ());
- FILE* f = fopen (fn.c_str (), "w");
- if (!f)
+ m_f = fopen (fn.c_str (), "w");
+ if (!m_f)
{
NS_FATAL_ERROR ("Unable to open Animation output file");
return false; // Can't open
}
- m_fHandle = fileno (f); // Set the file handle
- m_usingSockets = false;
m_outputFileName = fn;
m_outputFileSet = true;
return true;
@@ -199,39 +161,6 @@
return false;
}
-bool AnimationInterface::SetServerPort (uint16_t port)
-{
-#if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_NETINET_IN_H)
- if (m_serverPortSet)
- {
- return true;
- }
- int s = socket (AF_INET, SOCK_STREAM, 0);
- struct sockaddr_in addr;
- addr.sin_family = AF_INET;
- addr.sin_port = htons (port);
- addr.sin_addr.s_addr = htonl (INADDR_ANY);
- if (bind (s, (struct sockaddr*)&addr, sizeof (addr)) < 0)
- {
- NS_LOG_WARN ("Can't bind to port " << port << ", exiting.");
- return false;
- }
- listen (s, 1);
- NS_LOG_INFO ("Waiting for animator connection");
- // Now wait for the animator to connect in
- m_fHandle = accept (s, 0, 0);
- NS_LOG_INFO ("Got animator connection from remote");
- // set the linger socket option
- int t = 1;
- setsockopt (s, SOL_SOCKET, SO_LINGER, &t, sizeof(t));
- m_usingSockets = true;
- m_serverPortSet = true;
- return true;
-#endif
- return false; // never reached unless the above is disabled
- // which is done to support a platform like MinGW
-}
-
bool AnimationInterface::WifiPacketIsPending (uint64_t AnimUid)
{
return (m_pendingWifiPackets.find (AnimUid) != m_pendingWifiPackets.end ());
@@ -416,14 +345,7 @@
{
m_currentPktCount = 0;
m_started = true;
- if (m_usingSockets)
- {
- SetServerPort (m_port);
- }
- else
- {
- SetOutputFile (m_outputFileName);
- }
+ SetOutputFile (m_outputFileName);
// Find the min/max x/y for the xml topology element
m_topoMinX = -2;
@@ -448,7 +370,7 @@
oss << GetXMLOpen_anim (0);
oss << GetPreamble ();
oss << GetXMLOpen_topology (m_topoMinX, m_topoMinY, m_topoMaxX, m_topoMaxY);
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
}
NS_LOG_INFO ("Setting topology for "<<NodeList::GetNNodes ()<<" Nodes");
// Dump the topology
@@ -460,7 +382,7 @@
{
Vector v = GetPosition (n);
oss << GetXMLOpenClose_node (0, n->GetId (), v.x, v.y);
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
}
else
{
@@ -468,7 +390,7 @@
Vector v = GetPosition (n);
oss << "0.0 N " << n->GetId ()
<< " " << v.x << " " << v.y << std::endl;
- WriteN (m_fHandle, oss.str ().c_str (), oss.str ().length ());
+ WriteN (oss.str ().c_str (), oss.str ().length ());
}
}
NS_LOG_INFO ("Setting p2p links");
@@ -508,7 +430,7 @@
{
oss << "0.0 L " << n1Id << " " << n2Id << std::endl;
}
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
}
}
}
@@ -520,13 +442,84 @@
}
if (m_xml && !restart)
{
- WriteN (m_fHandle, GetXMLClose ("topology"));
+ WriteN (GetXMLClose ("topology"));
Simulator::Schedule (m_mobilityPollInterval, &AnimationInterface::MobilityAutoCheck, this);
}
if (!restart)
ConnectCallbacks ();
}
+void AnimationInterface::ConnectLteEnb (Ptr <Node> n, Ptr <LteEnbNetDevice> nd, uint32_t devIndex)
+{
+
+ Ptr<LteEnbPhy> lteEnbPhy = nd->GetPhy ();
+ Ptr<LteSpectrumPhy> dlPhy = lteEnbPhy->GetDownlinkSpectrumPhy ();
+ Ptr<LteSpectrumPhy> ulPhy = lteEnbPhy->GetUplinkSpectrumPhy ();
+ std::ostringstream oss;
+ //NodeList/*/DeviceList/*/
+ oss << "NodeList/" << n->GetId () << "/DeviceList/" << devIndex << "/";
+ if (dlPhy)
+ {
+ dlPhy->TraceConnect ("TxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this));
+ dlPhy->TraceConnect ("RxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this));
+ }
+ if (ulPhy)
+ {
+ ulPhy->TraceConnect ("TxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this));
+ ulPhy->TraceConnect ("RxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this));
+ }
+}
+
+
+
+void AnimationInterface::ConnectLteUe (Ptr <Node> n, Ptr <LteUeNetDevice> nd, uint32_t devIndex)
+{
+
+ Ptr<LteUePhy> lteUePhy = nd->GetPhy ();
+ Ptr<LteSpectrumPhy> dlPhy = lteUePhy->GetDownlinkSpectrumPhy ();
+ Ptr<LteSpectrumPhy> ulPhy = lteUePhy->GetUplinkSpectrumPhy ();
+ std::ostringstream oss;
+ //NodeList/*/DeviceList/*/
+ oss << "NodeList/" << n->GetId () << "/DeviceList/" << devIndex << "/";
+ if (dlPhy)
+ {
+ dlPhy->TraceConnect ("TxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this));
+ dlPhy->TraceConnect ("RxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this));
+ }
+ if (ulPhy)
+ {
+ ulPhy->TraceConnect ("TxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyTxStart, this));
+ ulPhy->TraceConnect ("RxStart",oss.str (), MakeCallback (&AnimationInterface::LteSpectrumPhyRxStart, this));
+ }
+}
+
+void AnimationInterface::ConnectLte ()
+{
+
+ for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
+ {
+ Ptr<Node> n = *i;
+ NS_ASSERT (n);
+ uint32_t nDevices = n->GetNDevices ();
+ for (uint32_t devIndex = 0; devIndex < nDevices; ++devIndex)
+ {
+ Ptr <NetDevice> nd = n->GetDevice(devIndex);
+ if (!nd)
+ continue;
+ Ptr<LteUeNetDevice> lteUeNetDevice = DynamicCast<LteUeNetDevice> (nd);
+ if (lteUeNetDevice)
+ {
+ ConnectLteUe (n, lteUeNetDevice, devIndex);
+ continue;
+ }
+ Ptr<LteEnbNetDevice> lteEnbNetDevice = DynamicCast<LteEnbNetDevice> (nd);
+ if (lteEnbNetDevice)
+ ConnectLteEnb (n, lteEnbNetDevice, devIndex);
+ }
+
+ }
+}
+
void AnimationInterface::ConnectCallbacks ()
{
// Connect the callbacks
@@ -555,6 +548,7 @@
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::CsmaNetDevice/MacRx",
MakeCallback (&AnimationInterface::CsmaMacRxTrace, this));
+ ConnectLte ();
}
@@ -564,32 +558,24 @@
m_started = false;
NS_LOG_INFO ("Stopping Animation");
ResetAnimWriteCallback ();
- if (m_fHandle > 0)
+ if (m_f)
{
if (m_xml)
{ // Terminate the anim element
- WriteN (m_fHandle, GetXMLClose ("anim"));
+ WriteN (GetXMLClose ("anim"));
}
- if (m_fHandle != STDOUT_FILENO)
- {
- close (m_fHandle);
- }
- m_outputFileSet = false;
- m_fHandle = -1;
+ fclose (m_f);
}
+ m_outputFileSet = false;
}
-int AnimationInterface::WriteN (int h, const std::string& st)
+int AnimationInterface::WriteN (const std::string& st)
{
- if (h < 0)
- {
- return 0;
- }
if (m_writeCallback)
{
m_writeCallback (st.c_str ());
}
- return WriteN (h, st.c_str (), st.length ());
+ return WriteN (st.c_str (), st.length ());
}
// Private methods
@@ -655,19 +641,15 @@
}
}
-int AnimationInterface::WriteN (HANDLETYPE h, const char* data, uint32_t count)
+int AnimationInterface::WriteN (const char* data, uint32_t count)
{
- if (h < 0)
- {
- return 0;
- }
// Write count bytes to h from data
uint32_t nLeft = count;
const char* p = data;
uint32_t written = 0;
while (nLeft)
{
- int n = write (h, p, nLeft);
+ int n = fwrite (p, 1, nLeft, m_f);
if (n <= 0)
{
return written;
@@ -693,7 +675,7 @@
oss << GetXMLOpenClose_rx (0, 0, fbRx, lbRx);
oss << GetXMLClose ("packet");
}
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
}
@@ -731,7 +713,7 @@
<< (now + rxTime - txTime).GetSeconds () << " " // first bit rx time
<< (now + rxTime).GetSeconds () << std::endl; // last bit rx time
}
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
}
@@ -865,7 +847,7 @@
oss << hdr.GetAddr2 ();
if (m_macToNodeIdMap.find (oss.str ()) == m_macToNodeIdMap.end ())
{
- NS_LOG_UNCOND (oss.str ());
+ //NS_LOG_UNCOND (oss.str ());
return;
}
Ptr <Node> txNode = NodeList::GetNode (m_macToNodeIdMap[oss.str ()]);
@@ -1017,6 +999,62 @@
OutputWirelessPacket (p, pktInfo, pktrxInfo);
}
+void AnimationInterface::LteSpectrumPhyTxStart (std::string context, Ptr<const PacketBurst> pb)
+{
+ if (!m_started || !IsInTimeWindow ())
+ return;
+ Ptr <NetDevice> ndev = GetNetDeviceFromContext (context);
+ NS_ASSERT (ndev);
+ Ptr <Node> n = ndev->GetNode ();
+ NS_ASSERT (n);
+
+ std::list <Ptr <Packet> > pbList = pb->GetPackets ();
+ for (std::list <Ptr <Packet> >::iterator i = pbList.begin ();
+ i != pbList.end ();
+ ++i)
+ {
+ Ptr <Packet> p = *i;
+ gAnimUid++;
+ NS_LOG_INFO ("LteSpectrumPhyTxTrace for packet:" << gAnimUid);
+ AnimPacketInfo pktinfo (ndev, Simulator::Now (), Simulator::Now () + Seconds (0.001), UpdatePosition (n));
+ //TODO 0.0001 is used until Lte implements TxBegin and TxEnd traces
+ AnimByteTag tag;
+ tag.Set (gAnimUid);
+ p->AddByteTag (tag);
+ AddPendingLtePacket (gAnimUid, pktinfo);
+ }
+}
+
+void AnimationInterface::LteSpectrumPhyRxStart (std::string context, Ptr<const PacketBurst> pb)
+{
+ if (!m_started || !IsInTimeWindow ())
+ return;
+ Ptr <NetDevice> ndev = GetNetDeviceFromContext (context);
+ NS_ASSERT (ndev);
+ Ptr <Node> n = ndev->GetNode ();
+ NS_ASSERT (n);
+
+ std::list <Ptr <Packet> > pbList = pb->GetPackets ();
+ for (std::list <Ptr <Packet> >::iterator i = pbList.begin ();
+ i != pbList.end ();
+ ++i)
+ {
+ Ptr <Packet> p = *i;
+ uint64_t AnimUid = GetAnimUidFromPacket (p);
+ NS_LOG_INFO ("LteSpectrumPhyRxTrace for packet:" << gAnimUid);
+ if (!LtePacketIsPending (AnimUid))
+ {
+ NS_LOG_WARN ("LteSpectrumPhyRxTrace: unknown Uid");
+ return;
+ }
+ AnimPacketInfo& pktInfo = m_pendingLtePackets[AnimUid];
+ pktInfo.ProcessRxBegin (ndev, Simulator::Now ());
+ pktInfo.ProcessRxEnd (ndev, Simulator::Now () + Seconds (0.001), UpdatePosition (n));
+ //TODO 0.001 is used until Lte implements RxBegin and RxEnd traces
+ AnimRxInfo pktrxInfo = pktInfo.GetRxInfo (ndev);
+ OutputWirelessPacket (p, pktInfo, pktrxInfo);
+ }
+}
void AnimationInterface::CsmaPhyTxBeginTrace (std::string context, Ptr<const Packet> p)
{
@@ -1129,7 +1167,7 @@
oss << GetXMLOpen_topology (m_topoMinX, m_topoMinY, m_topoMaxX, m_topoMaxY);
oss << GetXMLOpenClose_node (0,n->GetId (),v.x,v.y);
oss << GetXMLClose ("topology");
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
WriteDummyPacket ();
}
@@ -1163,7 +1201,7 @@
oss << GetXMLOpenClose_node (0, n->GetId (), v.x, v.y);
}
oss << GetXMLClose ("topology");
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
WriteDummyPacket ();
if (!Simulator::IsFinished ())
{
@@ -1251,7 +1289,7 @@
oss << GetXMLOpenClose_meta (GetPacketMetadata (p));
oss << GetXMLClose ("wpacket");
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
}
void AnimationInterface::OutputCsmaPacket (Ptr<const Packet> p, AnimPacketInfo &pktInfo, AnimRxInfo pktrxInfo)
@@ -1268,7 +1306,7 @@
if (m_enablePacketMetadata)
oss << GetXMLOpenClose_meta (GetPacketMetadata (p));
oss << GetXMLClose ("packet");
- WriteN (m_fHandle, oss.str ());
+ WriteN (oss.str ());
}
void AnimationInterface::SetConstantPosition (Ptr <Node> n, double x, double y, double z)
--- a/src/netanim/model/animation-interface.h Tue May 29 10:42:17 2012 +0200
+++ b/src/netanim/model/animation-interface.h Tue May 29 14:13:23 2012 +0200
@@ -34,21 +34,8 @@
#include "ns3/config.h"
#include "ns3/animation-interface-helper.h"
#include "ns3/mac48-address.h"
-
-#ifdef WIN32
-#include <winsock2.h>
-#include <io.h>
-#define STDOUT_FILENO (SOCKET)GetStdHandle(STD_OUTPUT_HANDLE)
-#define close _close
-#define write _write
-#undef GetObject
-#undef min
-#undef max
-#define HANDLETYPE SOCKET
-#else
-#include "ns3/netanim-config.h"
-#define HANDLETYPE int
-#endif
+#include "ns3/lte-ue-net-device.h"
+#include "ns3/lte-enb-net-device.h"
namespace ns3 {
@@ -73,18 +60,6 @@
public:
/**
- * \brief Construct the animator interface. No arguments needed.
- *
- */
- AnimationInterface ();
-
- /**
- * \brief Destructor for the animator interface.
- *
- */
- ~AnimationInterface ();
-
- /**
* \brief Constructor
* \param filename The Filename for the trace file used by the Animator
* \param maxPktsPerFile The maximum number of packets per trace file.
@@ -99,13 +74,10 @@
bool usingXML = true);
/**
- * \brief Constructor
- * \param port Port on which ns-3 should listen to for connection from the
- * external netanim application
- * \param usingXML Set to true if XML output traces are required
+ * \brief Destructor for the animator interface.
*
*/
- AnimationInterface (uint16_t port, bool usingXML = true);
+ ~AnimationInterface ();
/**
* \brief Check if AnimationInterface is initialized
@@ -155,21 +127,6 @@
void SetStopTime (Time t);
/**
- * \brief (Deprecated) Specify that animation commands are to be written to
- * a socket.
- *
- * This call is used to set the ns3 process in server mode, waiting
- * for a TCP connection from the animator. This call will not
- * return until the animator connects in, or if the bind to the
- * specified port fails.
- *
- * \param port Port number to bind to.
- * \returns true if connection created, false if bind failed.
- *
- */
- bool SetServerPort (uint16_t port);
-
- /**
* \brief Writes the topology information and sets up the appropriate
* animation packet tx callback
*
@@ -289,21 +246,13 @@
private:
-#ifndef WIN32
- int m_fHandle; // File handle for output (-1 if none)
+ FILE * m_f; // File handle for output (-1 if none)
// Write specified amount of data to the specified handle
- int WriteN (int, const char*, uint32_t);
-#else
- SOCKET m_fHandle; // File handle for output (-1 if none)
- int WriteN (SOCKET, const char*, uint32_t);
-#endif
+ int WriteN (const char*, uint32_t);
bool m_xml; // True if xml format desired
Time m_mobilityPollInterval;
- bool m_usingSockets;
- uint16_t m_port;
std::string m_outputFileName;
bool m_outputFileSet;
- bool m_serverPortSet;
uint64_t gAnimUid ; // Packet unique identifier used by Animtion
bool m_randomPosition;
AnimWriteCallback m_writeCallback;
@@ -357,10 +306,15 @@
Ptr<const Packet> p,
const Mac48Address &);
+ void LteSpectrumPhyTxStart (std::string context,
+ Ptr<const PacketBurst> pb);
+ void LteSpectrumPhyRxStart (std::string context,
+ Ptr<const PacketBurst> pb);
+
void MobilityCourseChangeTrace (Ptr <const MobilityModel> mob);
// Write a string to the specified handle;
- int WriteN (int, const std::string&);
+ int WriteN (const std::string&);
void OutputWirelessPacket (Ptr<const Packet> p, AnimPacketInfo& pktInfo, AnimRxInfo pktrxInfo);
void OutputCsmaPacket (Ptr<const Packet> p, AnimPacketInfo& pktInfo, AnimRxInfo pktrxInfo);
@@ -403,6 +357,9 @@
std::vector < Ptr <Node> > RecalcTopoBounds ();
void ConnectCallbacks ();
+ void ConnectLte ();
+ void ConnectLteUe (Ptr <Node> n, Ptr <LteUeNetDevice> nd, uint32_t devIndex);
+ void ConnectLteEnb (Ptr <Node> n, Ptr <LteEnbNetDevice> nd, uint32_t devIndex);
std::map <std::string, uint32_t> m_macToNodeIdMap;
--- a/src/netanim/wscript Tue May 29 10:42:17 2012 +0200
+++ b/src/netanim/wscript Tue May 29 14:13:23 2012 +0200
@@ -29,8 +29,6 @@
if (bld.env['ENABLE_EXAMPLES']) :
bld.add_subdirs ('examples')
- bld.ns3_python_bindings ()
-
def configure (conf) :
conf.check (header_name='sys/socket.h', define_name='HAVE_SYS_SOCKET_H')
conf.check (header_name='netinet/in.h', define_name='HAVE_NETINET_IN_H')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/network/test/ipv6-address-test-suite.cc Tue May 29 14:13:23 2012 +0200
@@ -0,0 +1,107 @@
+/* -*- 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
+ */
+
+#include "ns3/test.h"
+#include "ns3/ipv6-address.h"
+
+using namespace ns3;
+
+class Ipv6AddressTestCase1 : public TestCase
+{
+public:
+ Ipv6AddressTestCase1 ();
+ virtual ~Ipv6AddressTestCase1 ();
+
+private:
+ virtual void DoRun (void);
+};
+
+Ipv6AddressTestCase1::Ipv6AddressTestCase1 ()
+ : TestCase ("serialization code")
+{
+}
+
+Ipv6AddressTestCase1::~Ipv6AddressTestCase1 ()
+{
+}
+
+void
+Ipv6AddressTestCase1::DoRun (void)
+{
+ Ipv6Address ip = Ipv6Address ("2001:db8::1");
+ uint8_t ipBytes[16];
+ ip.Serialize (ipBytes);
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[0], 0x20, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[1], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[2], 0x0d, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[3], 0xb8, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[15], 1, "Failed string conversion");
+
+ ip = Ipv6Address ("2001:db8:1::1");
+ ip.Serialize (ipBytes);
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[0], 0x20, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[1], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[2], 0x0d, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[3], 0xb8, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[5], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[15], 1, "Failed string conversion");
+
+ // Zero padding
+ ip = Ipv6Address ("2001:0db8:0001::1");
+ ip.Serialize (ipBytes);
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[0], 0x20, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[1], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[2], 0x0d, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[3], 0xb8, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[5], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[15], 1, "Failed string conversion");
+
+ ip = Ipv6Address ("2001:db8:0:1::1");
+ ip.Serialize (ipBytes);
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[0], 0x20, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[1], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[2], 0x0d, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[3], 0xb8, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[7], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[15], 1, "Failed string conversion");
+
+ ip = Ipv6Address ("2001:db8:0:1:0:0:0:1");
+ ip.Serialize (ipBytes);
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[0], 0x20, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[1], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[2], 0x0d, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[3], 0xb8, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[7], 0x01, "Failed string conversion");
+ NS_TEST_ASSERT_MSG_EQ (ipBytes[15], 1, "Failed string conversion");
+
+ // Please add more tests below
+
+}
+
+class Ipv6AddressTestSuite : public TestSuite
+{
+public:
+ Ipv6AddressTestSuite ();
+};
+
+Ipv6AddressTestSuite::Ipv6AddressTestSuite ()
+ : TestSuite ("ipv6-address", UNIT)
+{
+ AddTestCase (new Ipv6AddressTestCase1);
+}
+
+static Ipv6AddressTestSuite ipv6AddressTestSuite;
+
--- a/src/network/wscript Tue May 29 10:42:17 2012 +0200
+++ b/src/network/wscript Tue May 29 14:13:23 2012 +0200
@@ -61,6 +61,7 @@
network_test.source = [
'test/buffer-test.cc',
'test/drop-tail-queue-test-suite.cc',
+ 'test/ipv6-address-test-suite.cc',
'test/packetbb-test-suite.cc',
'test/packet-test-suite.cc',
'test/packet-metadata-test.cc',
--- a/src/point-to-point-layout/model/point-to-point-dumbbell.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/point-to-point-layout/model/point-to-point-dumbbell.cc Tue May 29 14:13:23 2012 +0200
@@ -166,7 +166,7 @@
Ipv6AddressHelper addressHelper;
v6network = Ipv6AddressGenerator::GetNetwork (prefix);
- addressHelper.NewNetwork (v6network, prefix);
+ addressHelper.SetBase (v6network, prefix);
m_routerInterfaces6 = addressHelper.Assign (m_routerDevices);
Ipv6AddressGenerator::NextNetwork (prefix);
@@ -174,7 +174,7 @@
for (uint32_t i = 0; i < LeftCount (); ++i)
{
v6network = Ipv6AddressGenerator::GetNetwork (prefix);
- addressHelper.NewNetwork (v6network, prefix);
+ addressHelper.SetBase (v6network, prefix);
NetDeviceContainer ndc;
ndc.Add (m_leftLeafDevices.Get (i));
@@ -190,7 +190,7 @@
for (uint32_t i = 0; i < RightCount (); ++i)
{
v6network = Ipv6AddressGenerator::GetNetwork (prefix);
- addressHelper.NewNetwork (v6network, prefix);
+ addressHelper.SetBase (v6network, prefix);
NetDeviceContainer ndc;
ndc.Add (m_rightLeafDevices.Get (i));
--- a/src/point-to-point-layout/model/point-to-point-grid.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/point-to-point-layout/model/point-to-point-grid.cc Tue May 29 14:13:23 2012 +0200
@@ -148,7 +148,7 @@
for (uint32_t j = 0; j < rowContainer.GetN (); j+=2)
{
v6network = Ipv6AddressGenerator::GetNetwork (prefix);
- addrHelper.NewNetwork(v6network, prefix);
+ addrHelper.SetBase(v6network, prefix);
Ipv6InterfaceContainer ic = addrHelper.Assign (rowContainer.Get (j));
rowInterfaces.Add (ic);
ic = addrHelper.Assign (rowContainer.Get (j+1));
@@ -169,7 +169,7 @@
for (uint32_t j = 0; j < colContainer.GetN (); j+=2)
{
v6network = Ipv6AddressGenerator::GetNetwork (prefix);
- addrHelper.NewNetwork(v6network, prefix);
+ addrHelper.SetBase(v6network, prefix);
Ipv6InterfaceContainer ic = addrHelper.Assign (colContainer.Get (j));
colInterfaces.Add (ic);
ic = addrHelper.Assign (colContainer.Get (j+1));
--- a/src/point-to-point-layout/model/point-to-point-star.cc Tue May 29 10:42:17 2012 +0200
+++ b/src/point-to-point-layout/model/point-to-point-star.cc Tue May 29 14:13:23 2012 +0200
@@ -119,7 +119,7 @@
for (uint32_t i = 0; i < m_spokes.GetN (); ++i)
{
v6network = Ipv6AddressGenerator::GetNetwork (prefix);
- addressHelper.NewNetwork(v6network, prefix);
+ addressHelper.SetBase (v6network, prefix);
Ipv6InterfaceContainer ic = addressHelper.Assign (m_hubDevices.Get (i));
m_hubInterfaces6.Add (ic);