diff --git a/doc/tutorial/introduction.texi b/doc/tutorial/introduction.texi index 5c761b88f..34403e981 100644 --- a/doc/tutorial/introduction.texi +++ b/doc/tutorial/introduction.texi @@ -1845,11 +1845,11 @@ source code for the script should look like the following: } @end verbatim -@cindex csma-echo.cc +@cindex tutorial-csma-echo.cc Just to make sure you don't get caught up in debugging typographical errors we have provided this source code for you (along with a copyright header) in the @code{tutorial} subdirectory of the @command{ns-3} distribution as -@code{csma-echo.cc}. We used this opportunity to do some ``clean up'' +@code{tutorial-csma-echo.cc}. We used this opportunity to do some ``clean up'' of some of our example cases by passing parameters using implicit conversion sequences and removing some of the named parameters. [These were used for pedagogic purposes and were not actually necessary.] @@ -1891,28 +1891,28 @@ local directory. The required libraries are linked for you for free. All that needed to be done in order to build the new simulation using the new source file was to copy the two lines describing the @code{hello-simulator} -program and change the names to @code{csma-echo}. You can see these lines -in the @code{wscript} file, +program and change the names to @code{tutorial-csma-echo}. You can see these +lines in the @code{wscript} file, @verbatim def build(bld): obj = bld.create_ns3_program('hello-simulator') obj.source = 'hello-simulator.cc' - obj = bld.create_ns3_program('csma-echo') - obj.source = 'csma-echo.cc' + obj = bld.create_ns3_program('tutorial-csma-echo') + obj.source = 'tutorial-csma-echo.cc' ... @end verbatim When you built the system above, you actually already built this new simulation and a number of other examples. Since you have already configured -@code{Waf} and built the @code{csma-echo} script, you can run the simulation -in the same way as you ran the @code{hello-simulator} script using the -@code{waf --run} command: +@code{Waf} and built the @code{tutorial-csma-echo} script, you can run the +simulation in the same way as you ran the @code{hello-simulator} script using +the @code{waf --run} command: @verbatim -~/repos/ns-3-dev/tutorial > waf --run csma-echo +~/repos/ns-3-dev/tutorial > waf --run tutorial-csma-echo Entering directory `~/repos/ns-3-dev/build' Compilation finished successfully UDP Echo Simulation diff --git a/doc/tutorial/other.texi b/doc/tutorial/other.texi index d1d964fd5..980f34ed6 100644 --- a/doc/tutorial/other.texi +++ b/doc/tutorial/other.texi @@ -37,13 +37,13 @@ you old-timers) cable. This topology is shown below. @center @image{pp,,,,png} We have provided a file for you in the @code{tutorial} -directory called @code{point-to-point.cc}. You should now be familiar enough -with the system to pick out fairly easily what has been changed. Let's focus -on the following lines: +directory called @code{tutorial-point-to-point.cc}. You should now be +familiar enough with the system to pick out fairly easily what has been +changed. Let's focus on the following lines: @verbatim - Ptr n0 = Create (); - Ptr n1 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); Ptr link = PointToPointTopology::AddPointToPointLink ( n0, n1, DataRate (38400), MilliSeconds (20)); @@ -79,7 +79,7 @@ to echo one packet across the point-to-point link. You should be now be able to build and run this example and to locate and interpret the ASCII trace file. This is left as an exercise for you. -The file @code{point-to-point.cc} is reproduced here for your +The file @code{tutorial-point-to-point.cc} is reproduced here for your convenience: @verbatim @@ -132,8 +132,8 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Point to Point Topology Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); Ptr link = PointToPointTopology::AddPointToPointLink ( n0, n1, DataRate (38400), MilliSeconds (20)); @@ -143,10 +143,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n0, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); @@ -167,7 +167,7 @@ main (int argc, char *argv[]) A point-to-point network is considered a special case of a star network. As you might expect, the process of constructing a star network is an extension of the very simple process used for a point-to-point link. We have provided -a file for you in the @code{tutorial} directory called @code{star.cc} +a file for you in the @code{tutorial} directory called @code{tutorial-star.cc} that implements a simple star network as seen below. @sp 1 @@ -190,13 +190,13 @@ six nodes surrounding (@code{n1} - @code{n6}). You should be able to easily find and understand the code that creates these nodes. @verbatim - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); - Ptr n4 = Create (); - Ptr n5 = Create (); - Ptr n6 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); + Ptr n4 = CreateObject (); + Ptr n5 = CreateObject (); + Ptr n6 = CreateObject (); @end verbatim Next, we get into the differences between the @code{PointToPointTopology} @@ -290,7 +290,7 @@ to echo one packet across the point-to-point link. You should be now be able to build and run this example and to locate and interpret the ASCII trace file. This is left as an exercise for you. -The file @code{star.cc} is reproduced here for your convenience: +The file @code{tutorial-star.cc} is reproduced here for your convenience: @verbatim /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ @@ -345,13 +345,13 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Star Topology Simulation"); - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); - Ptr n4 = Create (); - Ptr n5 = Create (); - Ptr n6 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); + Ptr n4 = CreateObject (); + Ptr n5 = CreateObject (); + Ptr n6 = CreateObject (); Ptr link01 = PointToPointIpv4Topology::CreateChannel (DataRate (38400), @@ -439,10 +439,10 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = Create (n0, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); - Ptr server = Create (n1, port); + Ptr server = CreateObject (n1, port); server->Start(Seconds(1.)); client->Start(Seconds(2.)); @@ -470,7 +470,7 @@ is that you have now created an internetwork. This means you will need to enable internetwork routing. We have provided a file for you in the @code{tutorial} directory called -@code{star-routing.cc} to show you how this is done. This extremely +@code{tutorial-star-routing.cc} to show you how this is done. This extremely tricky and difficult change is shown below: @verbatim @@ -483,11 +483,11 @@ build internetwork routing tables for all of the nodes in the simulation. We changed the client application so that it runs on node four: @verbatim - Ptr client = Create (n4, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n4, "10.1.1.2", + port, 1, Seconds(1.), 1024); @end verbatim -Now if you build and run @code{star-routing.cc} you can examine the +Now if you build and run @code{tutorial-star-routing.cc} you can examine the @code{tutorial.tr} file and see that your UDP echo packets are now correctly routed through the topology. @@ -508,7 +508,7 @@ The following is a representation of the topology. We have provided a file that constructs this dumbbell network and creates enough data flowing across the choke point that some packets will be dropped. -The file is called @code{linear-dumbbell.cc} and is located in the +The file is called @code{tutorial-linear-dumbbell.cc} and is located in the @code{tutorial} directory. We have already covered all of the code used to create this network, so we will just quickly go over the main sections of the script. @@ -521,10 +521,10 @@ process to create our first example. // // Create the lan on the left side of the dumbbell. // - Ptr n0 = Create (); - Ptr n1 = Create (); - Ptr n2 = Create (); - Ptr n3 = Create (); + Ptr n0 = CreateObject (); + Ptr n1 = CreateObject (); + Ptr n2 = CreateObject (); + Ptr n3 = CreateObject (); Ptr lan1 = CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2)); @@ -554,10 +554,10 @@ have been changed. // // Create the lan on the right side of the dumbbell. // - Ptr n4 = Create (); - Ptr n5 = Create (); - Ptr n6 = Create (); - Ptr n7 = Create (); + Ptr n4 = CreateObject (); + Ptr n5 = CreateObject (); + Ptr n6 = CreateObject (); + Ptr n7 = CreateObject (); Ptr lan2 = CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2)); @@ -615,19 +615,19 @@ clients to slowly bring up the data rates. // uint16_t port = 7; - Ptr client0 = Create (n0, "10.1.2.1", port, - 100, Seconds(.01), 1024); - Ptr client1 = Create (n1, "10.1.2.2", port, - 100, Seconds(.01), 1024); - Ptr client2 = Create (n2, "10.1.2.3", port, - 100, Seconds(.01), 1024); - Ptr client3 = Create (n3, "10.1.2.4", port, - 100, Seconds(.01), 1024); + Ptr client0 = CreateObject (n0, "10.1.2.1", + port, 100, Seconds(.01), 1024); + Ptr client1 = CreateObject (n1, "10.1.2.2", + port, 100, Seconds(.01), 1024); + Ptr client2 = CreateObject (n2, "10.1.2.3", + port, 100, Seconds(.01), 1024); + Ptr client3 = CreateObject (n3, "10.1.2.4", + port, 100, Seconds(.01), 1024); - Ptr server4 = Create (n4, port); - Ptr server5 = Create (n5, port); - Ptr server6 = Create (n6, port); - Ptr server7 = Create (n7, port); + Ptr server4 = CreateObject (n4, port); + Ptr server5 = CreateObject (n5, port); + Ptr server6 = CreateObject (n6, port); + Ptr server7 = CreateObject (n7, port); server4->Start(Seconds(1.)); server5->Start(Seconds(1.)); @@ -651,10 +651,10 @@ clients to slowly bring up the data rates. @end verbatim The remainder of the file should be quite familiar to you. Go ahead and -run @code{linear-dumbbell}. Now take a look at the trace (@code{tutorial.tr}) -file. You will now see trace lines that begin with @code{d}. Alternatively -you can search for the string ``queue-drop'' which is the expansion of the -drop code. +run @code{tutorial-linear-dumbbell}. Now take a look at the trace +(@code{tutorial.tr}) file. You will now see trace lines that begin with +@code{d}. Alternatively you can search for the string ``queue-drop'' which +is the expansion of the drop code ('d'). Interpretation of a dropped packet is straightforward. We have expanded the first @code{queue-drop} trace for you below. See the section on ASCII @@ -699,7 +699,7 @@ overhead. We're going to remedy that situation shortly. We have written a number of @command{ns-3} scripts in C++. Although we have been perfectly linear in our script implementations, just like any other C++ program, an @command{ns-3} script can use any features of the language you -desire. If you will look back at the @code{linear-dumbbell.cc} +desire. If you will look back at the @code{tutorial-linear-dumbbell.cc} example, you may notice that the code to create the left and right sides of the dumbbell is operationally identical --- only the names change. An obvious improvement of this program would be to use subroutines to create the sides. @@ -841,12 +841,12 @@ hiding). Let's use this guidance to finish up our class declarations: @end verbatim That's it. We have actually already walked through almost all of the code -required to construct a bus network in our @code{csma-echo.cc} +required to construct a bus network in our @code{tutorial-csma-echo.cc} example, so let's just jump forward and take a look at an implementation of this thing. We provide an implementation for you in the files @code{ipv4-bus-network.h} and @code{ipv4-bus-network.cc} located in the @code{tutorial} directory. We also provide an example that uses the new -class in the file @code{bus-network.cc}. +class in the file @code{tutorial-bus-network.cc}. The interesting method from our current perspective is the Ipv4BusNetwork constructor, shown below: @@ -869,7 +869,7 @@ constructor, shown below: for (uint32_t i = 0; i < n; ++i) { - Ptr node = Create (); + Ptr node = CreateObject (); uint32_t nd = CsmaIpv4Topology::AddIpv4CsmaNetDevice (node, m_channel, Mac48Address::Allocate ()); Ipv4Address address = Ipv4AddressGenerator::AllocateAddress (mask, @@ -978,7 +978,7 @@ For your convenience, we reproduce the entire bus network implementation below: for (uint32_t i = 0; i < n; ++i) { - Ptr node = Create (); + Ptr node = CreateObject (); uint32_t nd = CsmaIpv4Topology::AddIpv4CsmaNetDevice (node, m_channel, Mac48Address::Allocate ()); Ipv4Address address = Ipv4AddressGenerator::AllocateAddress (mask, @@ -1125,7 +1125,7 @@ Previously, you have seen objects created using the template function @code{Create} as in the following example: @verbatim - Ptr n0 = Create (); + Ptr n0 = CreateObject (); @end verbatim This line of code, while it may be unfamiliar to some, is pure C++. If you @@ -1393,9 +1393,9 @@ These are just normal, everyday C++ objects that we can create using the following code should be obvious to you by now: @verbatim - Ptr a = Create (); - Ptr b = Create (); - Ptr c = Create (); + Ptr a = CreateObject (); + Ptr b = CreateObject (); + Ptr c = CreateObject (); @end verbatim When you create an aggregation, you pick one of the Interfaces to act as @@ -1588,8 +1588,8 @@ second inherits from class @code{Base}. We could create these interfaces as we usually do, @verbatim -Ptr base = Create (); -Ptr derived = Create (); +Ptr base = CreateObject (); +Ptr derived = CreateObject (); @end verbatim The derived and base @code{InterfaceIds} are either present or not present @@ -1621,7 +1621,7 @@ Interface is found all over our example programs. For example, you will find code like the following in @code{samples/simple-point-to-point.cc}: @verbatim - Ptr n = Create (); + Ptr n = CreateObject (); @end verbatim This code is described in detail in previous sections, but the important thing @@ -1696,7 +1696,7 @@ that class @code{Node} is an Interface and class @code{InternetNode} inherits from class @code{Node}): @verbatim - Ptr ipv4Impl = Create (ipv4); + Ptr ipv4Impl = CreateObject (ipv4); ... Object::AddInterface (ipv4Impl); @end verbatim @@ -1727,7 +1727,7 @@ Returning to some @command{ns-3} example code, lets take a look at following code: @verbatim - Ptr n0 = Create (); + Ptr n0 = CreateObject (); ... Ptr ipv4; ipv4 = n0->QueryInterface (Ipv4::iid); diff --git a/doc/tutorial/output.texi b/doc/tutorial/output.texi index ff2916f48..5c18281ca 100644 --- a/doc/tutorial/output.texi +++ b/doc/tutorial/output.texi @@ -108,7 +108,7 @@ to the popular trace points that log "+", "-", "d", and "r" events. Try running the following program from the command line: @verbatim - ./waf --run csma-echo-ascii-trace + ./waf --run tutorial-csma-echo-ascii-trace @end verbatim @cindex tutorial.tr @@ -391,12 +391,12 @@ format, including X, Y, and Z. We encourage users to exploit the many tools available for analyzing pcap traces; below, we show how tcpdump and Wireshark can be used.. -@cindex csma-echo-ascii-trace.cc -@cindex csma-echo-pcap-trace.cc +@cindex tutorial-csma-echo-ascii-trace.cc +@cindex tutorial-csma-echo-pcap-trace.cc The code used to enable pcap tracing is similar to that for ASCII tracing. -We have provided another file, @code{csma-echo-pcap-trace.cc} that uses the -pcap trace wrapper. We have added the code to include the pcap trace wrapper -defintions: +We have provided another file, @code{tutorial-csma-echo-pcap-trace.cc} that +uses the pcap trace wrapper. We have added the code to include the pcap +trace wrapper defintions: @verbatim #include "ns3/pcap-trace.h" @@ -432,7 +432,7 @@ You may run the new program just like all of the others so far: @cindex Waf @verbatim - ./waf --run csma-echo-pcap-trace + ./waf --run tutorial-csma-echo-pcap-trace @end verbatim If you look at the top level directory of your distribution, you should now diff --git a/tutorial/energy.cc b/tutorial/energy.cc index a8eb5a65f..6604131be 100644 --- a/tutorial/energy.cc +++ b/tutorial/energy.cc @@ -64,8 +64,8 @@ main (int argc, char *argv[]) NS_LOG_INFO ("Creating Applications"); uint16_t port = 7; - Ptr client = - CreateObject (n0, "10.1.1.2", port, 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); Ptr server = CreateObject (n1, port); diff --git a/tutorial/tutorial-bus-network.cc b/tutorial/tutorial-bus-network.cc index 056d4c16d..f61af0376 100644 --- a/tutorial/tutorial-bus-network.cc +++ b/tutorial/tutorial-bus-network.cc @@ -41,8 +41,8 @@ main (int argc, char *argv[]) uint32_t port = 7; Ptr n0 = bus.GetNode (0); - Ptr client = CreateObject (n0, "10.1.0.1", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.0.1", + port, 1, Seconds(1.), 1024); Ptr n1 = bus.GetNode (1); Ptr server = CreateObject (n1, port); diff --git a/tutorial/tutorial-csma-echo-ascii-trace.cc b/tutorial/tutorial-csma-echo-ascii-trace.cc index ce17a1753..f7b6256ce 100644 --- a/tutorial/tutorial-csma-echo-ascii-trace.cc +++ b/tutorial/tutorial-csma-echo-ascii-trace.cc @@ -66,8 +66,8 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = CreateObject (n0, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); Ptr server = CreateObject (n1, port); diff --git a/tutorial/tutorial-csma-echo-pcap-trace.cc b/tutorial/tutorial-csma-echo-pcap-trace.cc index ee0cc5e65..ad657e577 100644 --- a/tutorial/tutorial-csma-echo-pcap-trace.cc +++ b/tutorial/tutorial-csma-echo-pcap-trace.cc @@ -67,8 +67,8 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = CreateObject (n0, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); Ptr server = CreateObject (n1, port); diff --git a/tutorial/tutorial-csma-echo.cc b/tutorial/tutorial-csma-echo.cc index 7f5a678ad..000e96734 100644 --- a/tutorial/tutorial-csma-echo.cc +++ b/tutorial/tutorial-csma-echo.cc @@ -65,8 +65,8 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = CreateObject (n0, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); Ptr server = CreateObject (n1, port); diff --git a/tutorial/tutorial-linear-dumbbell.cc b/tutorial/tutorial-linear-dumbbell.cc index 59bef5b3b..c88df894e 100644 --- a/tutorial/tutorial-linear-dumbbell.cc +++ b/tutorial/tutorial-linear-dumbbell.cc @@ -124,14 +124,14 @@ main (int argc, char *argv[]) // uint16_t port = 7; - Ptr client0 = CreateObject (n0, "10.1.2.1", port, - 100, Seconds(.01), 1024); - Ptr client1 = CreateObject (n1, "10.1.2.2", port, - 100, Seconds(.01), 1024); - Ptr client2 = CreateObject (n2, "10.1.2.3", port, - 100, Seconds(.01), 1024); - Ptr client3 = CreateObject (n3, "10.1.2.4", port, - 100, Seconds(.01), 1024); + Ptr client0 = CreateObject (n0, "10.1.2.1", + port, 100, Seconds(.01), 1024); + Ptr client1 = CreateObject (n1, "10.1.2.2", + port, 100, Seconds(.01), 1024); + Ptr client2 = CreateObject (n2, "10.1.2.3", + port, 100, Seconds(.01), 1024); + Ptr client3 = CreateObject (n3, "10.1.2.4", + port, 100, Seconds(.01), 1024); Ptr server4 = CreateObject (n4, port); Ptr server5 = CreateObject (n5, port); diff --git a/tutorial/tutorial-point-to-point.cc b/tutorial/tutorial-point-to-point.cc index 8c42eded7..088ac796b 100644 --- a/tutorial/tutorial-point-to-point.cc +++ b/tutorial/tutorial-point-to-point.cc @@ -58,8 +58,8 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = CreateObject (n0, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); Ptr server = CreateObject (n1, port); diff --git a/tutorial/tutorial-star-routing.cc b/tutorial/tutorial-star-routing.cc index e0a91cf14..8e9a6e828 100644 --- a/tutorial/tutorial-star-routing.cc +++ b/tutorial/tutorial-star-routing.cc @@ -145,8 +145,8 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = CreateObject (n4, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n4, "10.1.1.2", + port, 1, Seconds(1.), 1024); Ptr server = CreateObject (n1, port); diff --git a/tutorial/tutorial-star.cc b/tutorial/tutorial-star.cc index 073d7c6c9..c2261afe9 100644 --- a/tutorial/tutorial-star.cc +++ b/tutorial/tutorial-star.cc @@ -145,8 +145,8 @@ main (int argc, char *argv[]) uint16_t port = 7; - Ptr client = CreateObject (n0, "10.1.1.2", port, - 1, Seconds(1.), 1024); + Ptr client = CreateObject (n0, "10.1.1.2", + port, 1, Seconds(1.), 1024); Ptr server = CreateObject (n1, port);