View | Details | Raw Unified | Return to bug 539
Collapse All | Expand All

(-)a/doc/tutorial/building-topologies.texi (-15 / +15 lines)
 Lines 248-254    Link Here 
248
Now we have a topology built, but we need applications.  This section is
248
Now we have a topology built, but we need applications.  This section is
249
going to be fundamentally similar to the applications section of 
249
going to be fundamentally similar to the applications section of 
250
@code{first.cc} but we are going to instantiate the server on one of the 
250
@code{first.cc} but we are going to instantiate the server on one of the 
251
nodes that has a CSMA node and the client on the node having only a 
251
nodes that has a CSMA device and the client on the node having only a 
252
point-to-point device.
252
point-to-point device.
253
253
254
First, we set up the echo server.  We create a @code{UdpEchoServerHelper} and
254
First, we set up the echo server.  We create a @code{UdpEchoServerHelper} and
 Lines 296-302    Link Here 
296
Since we have actually built an internetwork here, we need some form of 
296
Since we have actually built an internetwork here, we need some form of 
297
internetwork routing.  @command{ns-3} provides what we call a global route 
297
internetwork routing.  @command{ns-3} provides what we call a global route 
298
manager to set up the routing tables on nodes.  This route manager has a 
298
manager to set up the routing tables on nodes.  This route manager has a 
299
global function that runs though the nodes created for the simulation and does
299
global function that runs through the nodes created for the simulation and does
300
the hard work of setting up routing for you.  
300
the hard work of setting up routing for you.  
301
301
302
Basically, what happens is that each node behaves as if it were an OSPF router
302
Basically, what happens is that each node behaves as if it were an OSPF router
 Lines 317-323    Link Here 
317
317
318
@verbatim
318
@verbatim
319
  PointToPointHelper::EnablePcapAll ("second");
319
  PointToPointHelper::EnablePcapAll ("second");
320
  CsmaHelper::EnablePcap ("second", csmaDevices.Get (0), true);
320
  CsmaHelper::EnablePcap ("second", csmaDevices.Get (1), true);
321
@end verbatim
321
@end verbatim
322
322
323
The CSMA network is a multi-point-to-point network.  This means that there 
323
The CSMA network is a multi-point-to-point network.  This means that there 
 Lines 336-343    Link Here 
336
network and ask it to perform a promiscuous sniff of the network, thereby
336
network and ask it to perform a promiscuous sniff of the network, thereby
337
emulating what @code{tcpdump} would do.  If you were on a Linux machine
337
emulating what @code{tcpdump} would do.  If you were on a Linux machine
338
you might do something like @code{tcpdump -i eth0} to get the trace.  
338
you might do something like @code{tcpdump -i eth0} to get the trace.  
339
In this case, we specify the device using @code{csmaDevices.Get(0)}, 
339
In this case, we specify the device using @code{csmaDevices.Get(1)}, 
340
which selects the zeroth device in the container.  Setting the final
340
which selects the first device in the container.  Setting the final
341
parameter to true enables promiscuous captures.
341
parameter to true enables promiscuous captures.
342
342
343
The last section of code just runs and cleans up the simulation just like
343
The last section of code just runs and cleans up the simulation just like
 Lines 374-380    Link Here 
374
@verbatim
374
@verbatim
375
  export NS_LOG=
375
  export NS_LOG=
376
  ./waf --run scratch/mysecond
376
  ./waf --run scratch/mysecond
377
#end verbatim
377
@end verbatim
378
378
379
Since we have set up the UDP echo applications to log just as we did in 
379
Since we have set up the UDP echo applications to log just as we did in 
380
@code{first.cc}, you will see similar output when you run the script.
380
@code{first.cc}, you will see similar output when you run the script.
 Lines 395-401    Link Here 
395
is from the echo client, indicating that it has received its echo back from
395
is from the echo client, indicating that it has received its echo back from
396
the server.
396
the server.
397
397
398
If you now go and look in the top level directory, you will find two trace 
398
If you now go and look in the top level directory, you will find three trace 
399
files:
399
files:
400
400
401
@verbatim
401
@verbatim
 Lines 648-654    Link Here 
648
648
649
To illustrate the difference between promiscuous and non-promiscuous traces, we
649
To illustrate the difference between promiscuous and non-promiscuous traces, we
650
also requested a non-promiscuous trace for the next-to-last node.  Go ahead and
650
also requested a non-promiscuous trace for the next-to-last node.  Go ahead and
651
take a look at the @code{tcpdump} for @code{second-10-0.pcap}.
651
take a look at the @code{tcpdump} for @code{second-100-0.pcap}.
652
652
653
@verbatim
653
@verbatim
654
  tcpdump -nn -tt -r second-100-0.pcap
654
  tcpdump -nn -tt -r second-100-0.pcap
 Lines 845-855    Link Here 
845
845
846
For simplicity, this code uses the default PHY layer configuration and
846
For simplicity, this code uses the default PHY layer configuration and
847
channel models which are documented in the API doxygen documentation for
847
channel models which are documented in the API doxygen documentation for
848
the @code{YansWifiChannelHelper::Default} and @code{YAnsWifiPhyHelper::Default}
848
the @code{YansWifiChannelHelper::Default} and @code{YansWifiPhyHelper::Default}
849
methods. Once these objects are created, we create a channel object
849
methods. Once these objects are created, we create a channel object
850
and associate it to our PHY layer object manager to make sure
850
and associate it to our PHY layer object manager to make sure
851
that all the PHY objects created layer by the @code{YansWifiPhyHelper}
851
that all the PHY layer objects created by the @code{YansWifiPhyHelper}
852
all share the same underlying channel, that is, they share the same
852
share the same underlying channel, that is, they share the same
853
wireless medium and can communication and interfere:
853
wireless medium and can communication and interfere:
854
854
855
@verbatim
855
@verbatim
 Lines 1108-1116    Link Here 
1108
@end verbatim
1108
@end verbatim
1109
1109
1110
The file ``third-0-0.pcap'' corresponds to the point-to-point device on node
1110
The file ``third-0-0.pcap'' corresponds to the point-to-point device on node
1111
zero -- the left side of the ``backbone.''  The file ``third-1-0.pcap'' 
1111
zero -- the left side of the ``backbone''.  The file ``third-1-0.pcap'' 
1112
corresponds to the point-to-point device on node one -- the right side of the
1112
corresponds to the point-to-point device on node one -- the right side of the
1113
``backbone.''  The file ``third-0-1.pcap'' will be the promiscuous (monitor
1113
``backbone''.  The file ``third-0-1.pcap'' will be the promiscuous (monitor
1114
mode) trace from the Wifi network and the file ``third-1-1.pcap'' will be the
1114
mode) trace from the Wifi network and the file ``third-1-1.pcap'' will be the
1115
promiscuous trace from the CSMA network.  Can you verify this by inspecting
1115
promiscuous trace from the CSMA network.  Can you verify this by inspecting
1116
the code?
1116
the code?
 Lines 1326-1334    Link Here 
1326
@uref{http://www.nsnam.org/doxygen-release/index.html,,ns-3 Doxygen}
1326
@uref{http://www.nsnam.org/doxygen-release/index.html,,ns-3 Doxygen}
1327
which you can find in the ``Modules'' tab.
1327
which you can find in the ``Modules'' tab.
1328
Under the ``core'' section, you will find a link to ``The list of all trace 
1328
Under the ``core'' section, you will find a link to ``The list of all trace 
1329
sources.''  You may find it interesting to try and hook some of these 
1329
sources.''.  You may find it interesting to try and hook some of these 
1330
traces yourself.  Additionally in the ``Modules'' documentation, there is
1330
traces yourself.  Additionally in the ``Modules'' documentation, there is
1331
a link to ``The list of all attributes.''  You can set the default value of 
1331
a link to ``The list of all attributes.''.  You can set the default value of 
1332
any of these @code{Attributes} via the command line as we have previously 
1332
any of these @code{Attributes} via the command line as we have previously 
1333
discussed.
1333
discussed.
1334
1334
(-)a/doc/tutorial/conceptual-overview.texi (-6 / +6 lines)
 Lines 276-282    Link Here 
276
@end verbatim
276
@end verbatim
277
277
278
to build the project.  So now if you look in the directory 
278
to build the project.  So now if you look in the directory 
279
@code{build/debug/ns-3} you will find the four module include files shown 
279
@code{build/debug/ns3} you will find the four module include files shown 
280
above.  You can take a look at the contents of these files and find that they
280
above.  You can take a look at the contents of these files and find that they
281
do include all of the public include files in their respective modules.
281
do include all of the public include files in their respective modules.
282
282
 Lines 308-315    Link Here 
308
308
309
We will use this statement as a convenient place to talk about our Doxygen
309
We will use this statement as a convenient place to talk about our Doxygen
310
documentation system.  If you look at the project web site, 
310
documentation system.  If you look at the project web site, 
311
@uref{http://www.nsnam.org,,ns-3 project}, you will find a link to ``APIs
311
@uref{http://www.nsnam.org,,ns-3 project}, you will find a link to ``Doxygen 
312
(Doxygen)'' in the navigation bar.  If you select this link, you will be
312
(ns-3-dev)'' in the navigation bar.  If you select this link, you will be
313
taken to our documentation page.
313
taken to our documentation page.
314
314
315
Along the left side, you will find a graphical representation of the structure
315
Along the left side, you will find a graphical representation of the structure
 Lines 601-607    Link Here 
601
helper.
601
helper.
602
602
603
Applications require a time to ``start'' generating traffic and may take an
603
Applications require a time to ``start'' generating traffic and may take an
604
optional time to ``stop.''  We provide both.  These times are set using  the
604
optional time to ``stop''.  We provide both.  These times are set using  the
605
@code{ApplicationContainer} methods @code{Start} and @code{Stop}.  These 
605
@code{ApplicationContainer} methods @code{Start} and @code{Stop}.  These 
606
methods take @code{Time} parameters.  In this case, we use an explicit C++
606
methods take @code{Time} parameters.  In this case, we use an explicit C++
607
conversion sequence to take the C++ double 1.0 and convert it to an 
607
conversion sequence to take the C++ double 1.0 and convert it to an 
 Lines 815-826    Link Here 
815
The source code is mainly in the @code{src} directory.  You can view source
815
The source code is mainly in the @code{src} directory.  You can view source
816
code either by clicking on the directory name or by clicking on the @code{files}
816
code either by clicking on the directory name or by clicking on the @code{files}
817
link to the right of the directory name.  If you click on the @code{src}
817
link to the right of the directory name.  If you click on the @code{src}
818
directory you be taken to the lising of the @code{src} subdirectories.  If you 
818
directory, you will be taken to the listing of the @code{src} subdirectories.  If you 
819
click on @code{core} subdirectory, you will find a list of files.  The first file
819
click on @code{core} subdirectory, you will find a list of files.  The first file
820
you will find (as of this writing) is @code{abort.h}.  If you 
820
you will find (as of this writing) is @code{abort.h}.  If you 
821
click on @code{abort.h} link, you will be sent to the source file for @code{abort.h}.
821
click on @code{abort.h} link, you will be sent to the source file for @code{abort.h}.
822
822
823
Our example scripts are in the @code{examples} directory.  The source code for
823
Our example scripts are in the @code{examples} directory.  The source code for
824
the helpers we have used in this chapter can be found in the 
824
the helpers we have used in this chapter can be found in the 
825
@code{src/helpers} directory.  Feel free to poke around in the directory tree to
825
@code{src/helper} directory.  Feel free to poke around in the directory tree to
826
get a feel for what is there and the style of @command{ns-3} programs.
826
get a feel for what is there and the style of @command{ns-3} programs.
(-)a/doc/tutorial/getting-started.texi (-13 / +14 lines)
 Lines 44-50    Link Here 
44
44
45
@cindex tarball
45
@cindex tarball
46
The @command{ns-3} code is available in Mercurial repositories on the server
46
The @command{ns-3} code is available in Mercurial repositories on the server
47
code.nsnam.org.  You can also download a tarball release at
47
@uref{http://code.nsnam.org}.  You can also download a tarball release at
48
@uref{http://www.nsnam.org/releases/}, or you can work with repositories
48
@uref{http://www.nsnam.org/releases/}, or you can work with repositories
49
using Mercurial.  We recommend using Mercurial unless there's a good reason
49
using Mercurial.  We recommend using Mercurial unless there's a good reason
50
not to.  See the end of this section for instructions on how to get a tarball
50
not to.  See the end of this section for instructions on how to get a tarball
 Lines 53-59    Link Here 
53
@cindex repository
53
@cindex repository
54
The simplest way to get started using Mercurial repositories is to use the
54
The simplest way to get started using Mercurial repositories is to use the
55
@code{ns-3-allinone} environment.  This is a set of scripts that manages the 
55
@code{ns-3-allinone} environment.  This is a set of scripts that manages the 
56
downloading and building of various subystems of @command{ns-3} for you.  We 
56
downloading and building of various subsystems of @command{ns-3} for you.  We 
57
recommend that you begin your @command{ns-3} adventures in this environment
57
recommend that you begin your @command{ns-3} adventures in this environment
58
as it can really simplify your life at this point.
58
as it can really simplify your life at this point.
59
59
 Lines 128-139    Link Here 
128
the more constant ns-3-dev here in the tutorial, but you can replace the 
128
the more constant ns-3-dev here in the tutorial, but you can replace the 
129
string ``ns-3-dev'' with your choice of release (e.g., ns-3.4 and 
129
string ``ns-3-dev'' with your choice of release (e.g., ns-3.4 and 
130
ns-3.4-ref-traces) in the text below.  You can find the latest version  of the
130
ns-3.4-ref-traces) in the text below.  You can find the latest version  of the
131
code either by inspection of the repository list or by going to the ``Getting 
131
code either by inspection of the repository list or by going to the 
132
Started'' web page and looking for the latest release identifier.
132
@uref{http://www.nsnam.org/getting_started.html,,``Getting Started''} 
133
web page and looking for the latest release identifier.
133
134
134
Go ahead and change into the @code{ns-3-allinone} directory you created when
135
Go ahead and change into the @code{ns-3-allinone} directory you created when
135
you cloned that repository.  We are now going to use the @code{download.py} 
136
you cloned that repository.  We are now going to use the @code{download.py} 
136
script to pull down the various pieces of @command{ns-3} you will be using/
137
script to pull down the various pieces of @command{ns-3} you will be using.
137
138
138
Go ahead and type the following into your shell (remember you can substitute
139
Go ahead and type the following into your shell (remember you can substitute
139
the name of your chosen release number instead of @code{ns-3-dev} -- like
140
the name of your chosen release number instead of @code{ns-3-dev} -- like
 Lines 257-271    Link Here 
257
  mkdir tarballs
258
  mkdir tarballs
258
  cd tarballs
259
  cd tarballs
259
  wget http://www.nsnam.org/releases/ns-allinone-3.4.tar.bz2
260
  wget http://www.nsnam.org/releases/ns-allinone-3.4.tar.bz2
260
  tar xjf ns-3.4.tar.bz2
261
  tar xjf ns-allinone-3.4.tar.bz2
261
@end verbatim 
262
@end verbatim 
262
263
263
If you change into the directory @code{ns-allinone-3.4} you should see a
264
If you change into the directory @code{ns-allinone-3.4} you should see a
264
number of files:
265
number of files:
265
266
266
@verbatim
267
@verbatim
267
build.py*     ns-3.4-RC2/             nsc-0.5.0/             util.py
268
build.py*     ns-3.4/             nsc-0.5.0/             README
268
constants.py  ns-3.4-RC2-ref-traces/  pybindgen-0.10.0.630/
269
constants.py  ns-3.4-ref-traces/  pybindgen-0.10.0.630/  util.py
269
@end verbatim 
270
@end verbatim 
270
271
271
You are now ready to build the @command{ns-3} distribution.
272
You are now ready to build the @command{ns-3} distribution.
 Lines 404-410    Link Here 
404
@end verbatim
405
@end verbatim
405
406
406
Note the last part of the above output.  Some ns-3 options are not enabled by
407
Note the last part of the above output.  Some ns-3 options are not enabled by
407
default or require support from the underlying system to work properly
408
default or require support from the underlying system to work properly.
408
For instance, to enable XmlTo, the library libxml-2.0 must be found on the
409
For instance, to enable XmlTo, the library libxml-2.0 must be found on the
409
system.  in the example above, this library was not found and the corresponding
410
system.  in the example above, this library was not found and the corresponding
410
feature was not enabled.  There is a feature to use sudo to set the suid bit of
411
feature was not enabled.  There is a feature to use sudo to set the suid bit of
 Lines 438-444    Link Here 
438
available in waf.  To explore these options, type:
439
available in waf.  To explore these options, type:
439
440
440
@verbatim
441
@verbatim
441
  ./waf -- help
442
  ./waf --help
442
@end verbatim
443
@end verbatim
443
444
444
We'll use some of the testing-related commands in the next section.
445
We'll use some of the testing-related commands in the next section.
 Lines 488-494    Link Here 
488
489
489
@cindex regression tests
490
@cindex regression tests
490
You can also run our regression test suite to ensure that your distribution and
491
You can also run our regression test suite to ensure that your distribution and
491
tool chain have produced binaries that generate output that is identical to
492
toolchain have produced binaries that generate output that is identical to
492
known-good reference output files.  You downloaded these reference traces to 
493
known-good reference output files.  You downloaded these reference traces to 
493
your machine during the download process above.  (Warning:  The @code{ns-3.2} 
494
your machine during the download process above.  (Warning:  The @code{ns-3.2} 
494
and @code{ns-3.3} releases do not use the @code{ns-3-allinone} environment
495
and @code{ns-3.3} releases do not use the @code{ns-3-allinone} environment
 Lines 505-511    Link Here 
505
has gone awry.  If the error was discovered in a pcap file, it will be useful
506
has gone awry.  If the error was discovered in a pcap file, it will be useful
506
to convert the pcap files to text using tcpdump prior to comparison.
507
to convert the pcap files to text using tcpdump prior to comparison.
507
508
508
Some regression tests wmay be SKIPped if the required support
509
Some regression tests may be SKIPped if the required support
509
is not present.
510
is not present.
510
511
511
To run the regression tests, you provide Waf with the regression flag.
512
To run the regression tests, you provide Waf with the regression flag.
 Lines 568-574    Link Here 
568
@end verbatim
569
@end verbatim
569
570
570
Waf first checks to make sure that the program is built correctly and 
571
Waf first checks to make sure that the program is built correctly and 
571
executes a build if required.  Waf then then executes the program, which 
572
executes a build if required.  Waf then executes the program, which 
572
produces the following output.
573
produces the following output.
573
574
574
@verbatim
575
@verbatim
(-)a/doc/tutorial/introduction.texi (-4 / +4 lines)
 Lines 226-232    Link Here 
226
order to extend the system in most cases.
226
order to extend the system in most cases.
227
227
228
For those interested in the gory details of Waf, the main web site can be 
228
For those interested in the gory details of Waf, the main web site can be 
229
found at @uref{http://freehackers.org/~tnagy/waf.html}.
229
found at @uref{http://code.google.com/p/waf/}.
230
230
231
@node Development Environment
231
@node Development Environment
232
@section Development Environment
232
@section Development Environment
 Lines 275-281    Link Here 
275
@cindex MinGW
275
@cindex MinGW
276
If you do use Cygwin or MinGW; and use Logitech products, we will save you
276
If you do use Cygwin or MinGW; and use Logitech products, we will save you
277
quite a bit of heartburn right off the bat and encourage you to take a look
277
quite a bit of heartburn right off the bat and encourage you to take a look
278
at the @uref{http://www.mingw.org/MinGWiki/index.php/FAQ,,MinGW FAQ}.
278
at the @uref{http://oldwiki.mingw.org/index.php/FAQ,,MinGW FAQ}.
279
279
280
@cindex Logitech
280
@cindex Logitech
281
Search for ``Logitech'' and read the FAQ entry, ``why does make often 
281
Search for ``Logitech'' and read the FAQ entry, ``why does make often 
 Lines 295-301    Link Here 
295
We will assume a basic facility with the Berkeley Sockets API in the examples
295
We will assume a basic facility with the Berkeley Sockets API in the examples
296
used in this tutorial.  If you are new to sockets, we recommend reviewing the
296
used in this tutorial.  If you are new to sockets, we recommend reviewing the
297
API and some common usage cases.  For a good overview of programming TCP/IP
297
API and some common usage cases.  For a good overview of programming TCP/IP
298
sockets we recommend @uref{http://www.elsevier.com/wps/product/cws_home/680765,,Practical TCP/IP Sockets in C, Donahoo and Calvert}.
298
sockets we recommend @uref{http://www.elsevier.com/wps/find/bookdescription.cws_home/717656/description#description,,TCP/IP Sockets in C, Donahoo and Calvert}.
299
299
300
There is an associated web site that includes source for the examples in the
300
There is an associated web site that includes source for the examples in the
301
book, which you can find at:
301
book, which you can find at:
 Lines 305-310    Link Here 
305
not have access to a copy of the book, the echo clients and servers shown in 
305
not have access to a copy of the book, the echo clients and servers shown in 
306
the website above) you will be in good shape to understand the tutorial.
306
the website above) you will be in good shape to understand the tutorial.
307
There is a similar book on Multicast Sockets,
307
There is a similar book on Multicast Sockets,
308
@uref{http://www.elsevier.com/wps/product/cws_home/700736,,Multicast Sockets, Makofske and Almeroth}.
308
@uref{http://www.elsevier.com/wps/find/bookdescription.cws_home/700736/description#description,,Multicast Sockets, Makofske and Almeroth}.
309
that covers material you may need to understand if you look at the multicast 
309
that covers material you may need to understand if you look at the multicast 
310
examples in the distribution.
310
examples in the distribution.
(-)a/doc/tutorial/tweaking.texi (-19 / +17 lines)
 Lines 112-118    Link Here 
112
example, to print more information by setting its logging level via the 
112
example, to print more information by setting its logging level via the 
113
NS_LOG environment variable.  
113
NS_LOG environment variable.  
114
114
115
I am going to assume from here on that are using an sh-like shell that uses 
115
I am going to assume from here on that you are using an sh-like shell that uses 
116
the``VARIABLE=value'' syntax.  If you are using a csh-like shell, then you 
116
the``VARIABLE=value'' syntax.  If you are using a csh-like shell, then you 
117
will have to convert my examples to the ``setenv VARIABLE value'' syntax 
117
will have to convert my examples to the ``setenv VARIABLE value'' syntax 
118
required by those shells.
118
required by those shells.
 Lines 353-359    Link Here 
353
353
354
You now know that you can enable all of the logging for this component by
354
You now know that you can enable all of the logging for this component by
355
setting the @code{NS_LOG} environment variable to the various levels.  Let's
355
setting the @code{NS_LOG} environment variable to the various levels.  Let's
356
go ahead add some logging to the script.  The macro used to add an 
356
go ahead and add some logging to the script.  The macro used to add an 
357
informational level log message is @code{NS_LOG_INFO}.  Go ahead and add one 
357
informational level log message is @code{NS_LOG_INFO}.  Go ahead and add one 
358
(just before we start creating the nodes) that tells you that the script is 
358
(just before we start creating the nodes) that tells you that the script is 
359
``Creating Topology.''  This is done as in this code snippet,
359
``Creating Topology.''  This is done as in this code snippet,
 Lines 439-445    Link Here 
439
439
440
This simple two line snippet is actually very useful by itself.  It opens the
440
This simple two line snippet is actually very useful by itself.  It opens the
441
door to the @command{ns-3} global variable and @code{Attribute} systems.  Go 
441
door to the @command{ns-3} global variable and @code{Attribute} systems.  Go 
442
ahead and add that two lines of code to the @code{scratch/first.cc} script at
442
ahead and add that two lines of code to the @code{scratch/myfirst.cc} script at
443
the start of @code{main}.  Go ahead and build the script and run it, but ask 
443
the start of @code{main}.  Go ahead and build the script and run it, but ask 
444
the script for help in the following way,
444
the script for help in the following way,
445
445
 Lines 497-503    Link Here 
497
setting in the @code{PointToPointHelper} above.  Let's use the default values 
497
setting in the @code{PointToPointHelper} above.  Let's use the default values 
498
for the point-to-point devices and channels by deleting the 
498
for the point-to-point devices and channels by deleting the 
499
@code{SetDeviceAttribute} call and the @code{SetChannelAttribute} call from 
499
@code{SetDeviceAttribute} call and the @code{SetChannelAttribute} call from 
500
the @code{first.cc} we have in the scratch directory.
500
the @code{myfirst.cc} we have in the scratch directory.
501
501
502
Your script should now just declare the @code{PointToPointHelper} and not do 
502
Your script should now just declare the @code{PointToPointHelper} and not do 
503
any @code{set} operations as in the following example,
503
any @code{set} operations as in the following example,
 Lines 801-808    Link Here 
801
  #include <fstream>
801
  #include <fstream>
802
@end verbatim
802
@end verbatim
803
803
804
Then, right before the before the call to @code{Simulator::Run ()}, add the
804
Then, right before the call to @code{Simulator::Run ()}, add the
805
following lines of code.
805
following lines of code:
806
806
807
@verbatim
807
@verbatim
808
  std::ofstream ascii;
808
  std::ofstream ascii;
 Lines 811-817    Link Here 
811
@end verbatim
811
@end verbatim
812
812
813
The first two lines are just vanilla C++ code to open a stream that will be
813
The first two lines are just vanilla C++ code to open a stream that will be
814
written to a file named ``myfirst.tr.''  See your favorite C++ tutorial if you
814
written to a file named ``myfirst.tr''.  See your favorite C++ tutorial if you
815
are unfamiliar with this code.  The last line of code in the snippet above
815
are unfamiliar with this code.  The last line of code in the snippet above
816
tells @command{ns-3} that you want to enable ASCII tracing on all 
816
tells @command{ns-3} that you want to enable ASCII tracing on all 
817
point-to-point devices in your simulation; and you want the (provided) trace
817
point-to-point devices in your simulation; and you want the (provided) trace
 Lines 900-906    Link Here 
900
created in a script.  Just as a filesystem may have directories under the 
900
created in a script.  Just as a filesystem may have directories under the 
901
root, we may have node numbers in the @code{NodeList}.  The string 
901
root, we may have node numbers in the @code{NodeList}.  The string 
902
@code{/NodeList/0} therefore refers to the zeroth node in the @code{NodeList}
902
@code{/NodeList/0} therefore refers to the zeroth node in the @code{NodeList}
903
which we typically think of as ``node 0.''  In each node there is a list of 
903
which we typically think of as ``node 0''.  In each node there is a list of 
904
devices that have been installed.  This list appears next in the namespace.
904
devices that have been installed.  This list appears next in the namespace.
905
You can see that this trace event comes from @code{DeviceList/0} which is the 
905
You can see that this trace event comes from @code{DeviceList/0} which is the 
906
zeroth device installed in the node. 
906
zeroth device installed in the node. 
 Lines 928-941    Link Here 
928
  00 r 
928
  00 r 
929
  01 2.25732 
929
  01 2.25732 
930
  02 /NodeList/1/DeviceList/0/$ns3::PointToPointNetDevice/MacRx 
930
  02 /NodeList/1/DeviceList/0/$ns3::PointToPointNetDevice/MacRx 
931
  03 ns3::PppHeader (
931
  03   ns3::Ipv4Header (
932
  04   Point-to-Point Protocol: IP (0x0021)) 
932
  04     tos 0x0 ttl 64 id 0 protocol 17 offset 0 flags [none]
933
  05   ns3::Ipv4Header (
933
  05     length: 1052 10.1.1.1 > 10.1.1.2)
934
  06     tos 0x0 ttl 64 id 0 offset 0 flags [none] 
934
  06     ns3::UdpHeader (
935
  07     length: 1052 10.1.1.1 > 10.1.1.2)
935
  07       length: 1032 49153 > 9) 
936
  08     ns3::UdpHeader (
936
  08       Payload (size=1024)
937
  09       length: 1032 49153 > 9) 
938
  10       Payload (size=1024)
939
@end verbatim
937
@end verbatim
940
938
941
Notice that the trace operation is now @code{r} and the simulation time has
939
Notice that the trace operation is now @code{r} and the simulation time has
 Lines 978-984    Link Here 
978
 and a ``.pcap'' suffix.
976
 and a ``.pcap'' suffix.
979
977
980
In our example script, we will eventually see files named ``myfirst-0-0.pcap'' 
978
In our example script, we will eventually see files named ``myfirst-0-0.pcap'' 
981
and ``myfirst.1-0.pcap'' which are the pcap traces for node 0-device 0 and 
979
and ``myfirst-1-0.pcap'' which are the pcap traces for node 0-device 0 and 
982
node 1-device 0, respectively.
980
node 1-device 0, respectively.
983
981
984
Once you have added the line of code to enable pcap tracing, you can run the
982
Once you have added the line of code to enable pcap tracing, you can run the
 Lines 1010-1018    Link Here 
1010
  2.257324 IP 10.1.1.2.9 > 10.1.1.1.49153: UDP, length 1024
1008
  2.257324 IP 10.1.1.2.9 > 10.1.1.1.49153: UDP, length 1024
1011
@end verbatim
1009
@end verbatim
1012
1010
1013
You can see in the dump of @code{myfirst-0.0.pcap} (the client device) that the 
1011
You can see in the dump of @code{myfirst-0-0.pcap} (the client device) that the 
1014
echo packet is sent at 2 seconds into the simulation.  If you look at the
1012
echo packet is sent at 2 seconds into the simulation.  If you look at the
1015
second dump (@code{first-1-0.pcap}) you can see that packet being received
1013
second dump (@code{myfirst-1-0.pcap}) you can see that packet being received
1016
at 2.257324 seconds.  You see the packet being echoed back at 2.257324 seconds
1014
at 2.257324 seconds.  You see the packet being echoed back at 2.257324 seconds
1017
in the second dump, and finally, you see the packet being received back at 
1015
in the second dump, and finally, you see the packet being received back at 
1018
the client in the first dump at 2.514648 seconds.
1016
the client in the first dump at 2.514648 seconds.

Return to bug 539