Documentation typos
This commit is contained in:
1 parent
e999a565af
commit
b3a1b16240
17 files changed
+64
-64
No files matched your search
@@ -20,7 +20,7 @@ other important resources that are available to those interested in using or
|
||||
writing scripts, models and even those interested in making contributions to
|
||||
the core ns-3 system. We provide an overview of some of the
|
||||
important abstractions, design patterns and idioms used when writing
|
||||
ns-3 scripts, and then dig right in by begining to write simulation
|
||||
ns-3 scripts, and then dig right in by beginning to write simulation
|
||||
scripts, run them and interpret results.
|
||||
|
||||
After completing this tutorial, one should be able to:
|
||||
@@ -749,8 +749,8 @@ an easy to use model.
|
||||
Topology helper functions use the abstractions (described above) of Network
|
||||
Interface Cards and Cables. When you think of adding a new kind of network,
|
||||
you may think of going out to the local computer retailer and buying a kit.
|
||||
This kit might include a nework cable and some number of peripheral cards and
|
||||
thier associated software drivers. You can think of topology helpers in
|
||||
This kit might include a network cable and some number of peripheral cards and
|
||||
their associated software drivers. You can think of topology helpers in
|
||||
roughly the same way. Instead of buying a kit for a given type of network,
|
||||
you will use a topology helper class for a given type of network, to accomplish
|
||||
the equivalent of installing the network ``kit.''
|
||||
@@ -758,7 +758,7 @@ the equivalent of installing the network ``kit.''
|
||||
@section Important Idioms
|
||||
Now that we have identified that there are C++ classes in the system called
|
||||
@code{Node} and @code{InternetNode}, we need to understand how to bring
|
||||
objects of these classes into existance, and manage their lifetimes. Let's
|
||||
objects of these classes into existence, and manage their lifetimes. Let's
|
||||
examine this in some detail here.
|
||||
|
||||
@cindex InternetNode
|
||||
@@ -1164,7 +1164,7 @@ To summarize: The magic happens in the assignment operator. Class
|
||||
Therefore, there exists a standard conversion from an @code{InternetNode *}
|
||||
to a @code{Node *} and by extension from an @code{InternetNode &} to a
|
||||
@code{Node &}. This conversion is applied automatically (and invisibly)
|
||||
during paramater passing in the assignment operator we are examining.
|
||||
during parameter passing in the assignment operator we are examining.
|
||||
|
||||
@cindex base class
|
||||
This is a rather involved way of saying there's an invisible pointer cast
|
||||
@@ -1202,7 +1202,7 @@ like:
|
||||
@cindex InternetNode
|
||||
@cindex smart pointer
|
||||
Now we know that this is really a simple statement. We create an
|
||||
@code{InternetNode} object on the heap (indirecly using operator @code{new}
|
||||
@code{InternetNode} object on the heap (indirectly using operator @code{new}
|
||||
and passing no parameters to its constructor) and assign responsibility for
|
||||
managing the new object's lifetime to a smart pointer. This smart pointer is
|
||||
a pointer to a @code{Node} object, so there was a hidden cast from
|
||||
@@ -1366,7 +1366,7 @@ was used in the example):
|
||||
@end itemize
|
||||
|
||||
C++ will attempt to promote parameters appropriately, but you will typically
|
||||
see constructions that respect the type corrrectness of the constructor, as
|
||||
see constructions that respect the type correctness of the constructor, as
|
||||
in @code{Seconds (1.)} and @code{MilliSeconds (2)}. Notice that the code
|
||||
@code{Seconds (1)} will work just as well as @code{Seconds (1.)} since the
|
||||
integer 1 will be automatically promoted to a double 1. in the former code.
|
||||
@@ -1547,7 +1547,7 @@ application as named parameters for clarity. We are telling the application
|
||||
to generate 1024 byte packets (@code{packetSize = 1024}); and to send these
|
||||
packets to port 7 (@code{port = 7;}). The application is told to send at most
|
||||
one packet (@code{maxPacketCount = 1;}); and to delay for one second between
|
||||
packet sends (@code{interpacketInterval = Seconds(1.)}) which is not used since
|
||||
packet sends (@code{interPacketInterval = Seconds(1.)}) which is not used since
|
||||
only one packet is sent. We will defer addressing the type @code{Time} until
|
||||
we discuss the simulator engine. For now just understand the semantics are
|
||||
to wait for one second.
|
||||
@@ -1780,17 +1780,17 @@ In ns-3 an event is basically a pre-packaged function call called a
|
||||
a more descriptive term --- an object (in the object-oriented programming
|
||||
sense) that can be called as if it was a function. Typically one uses a
|
||||
functor to implement @emph{deferred execution} of a function or method. The
|
||||
most commonly encoutered form of deferred execution is in a @emph{callback}
|
||||
most commonly encountered form of deferred execution is in a @emph{callback}
|
||||
from an I/O system. In this case, the goal would be to start an I/O
|
||||
operation and return immediately, without having to wait for the operation
|
||||
to complete. One asks the I/O subsytem to notify you when an operation is
|
||||
to complete. One asks the I/O subsystem to notify you when an operation is
|
||||
complete by calling some function you provide. This provided function is
|
||||
known as a callback function. [Imagine calling someone on the telephone and
|
||||
asking them to do something for you. You also ask them to @emph{call you back}
|
||||
when they are done.] Events in the ns-3 system work conceptually
|
||||
the same way, except that instead of an I/O completion driving the process,
|
||||
the arrival of some simulated time drives the process. The ns-3
|
||||
deferred exectution mechanism is via a class called @code{Callback}.
|
||||
deferred execution mechanism is via a class called @code{Callback}.
|
||||
|
||||
@cindex Time
|
||||
@cindex Callback
|
||||
|
||||
@@ -584,7 +584,7 @@ have been changed.
|
||||
|
||||
Next, we create a point to point link to connect the two lans. We connect
|
||||
the point-to-point channel between nodes three (on the left lan) and four
|
||||
(on the right lan). You should recoginze this as substantially similar to
|
||||
(on the right lan). You should recognize this as substantially similar to
|
||||
the link setup from the @code{point-to-point} example.
|
||||
|
||||
@verbatim
|
||||
@@ -735,7 +735,7 @@ give you a starting point for required classes and member variables.
|
||||
Immediately we can notice that at the highest level we are talking about the
|
||||
noun @emph{network}. This probably won't surprise you. We also have an
|
||||
adjective that modifies the noun --- @emph{bus}. This should lead us to our
|
||||
first class defintion. Usually class names are constructed in the same way
|
||||
first class definition. Usually class names are constructed in the same way
|
||||
as an English language sentence would be spoken. For example, one would speak
|
||||
of a @emph{bus network} in conversation, so we would normally create a
|
||||
@code{class BusNetwork} to represent it.
|
||||
@@ -901,7 +901,7 @@ after this initialization. They are:
|
||||
Ipv4AddressGenerator::SeedAddress (mask, baseAddress);
|
||||
@end verbatim
|
||||
|
||||
We provide an IP address generator class to allow us to programatically
|
||||
We provide an IP address generator class to allow us to programmatically
|
||||
allocate IP addresses. The first call to @code{SeedNetwork} gives the
|
||||
address generator a starting network number to use when generating addresses.
|
||||
The second call to @code{SeedAddress} gives the address generator a starting
|
||||
@@ -1011,7 +1011,7 @@ relatively abstract bus class, we can create bus networks with 4, 40 or 4000
|
||||
nodes with no additional effort.
|
||||
|
||||
A use of the bus network class is shown in the file
|
||||
@code{bus-netowrk.cc} located in the @code{tutorial} directory. The
|
||||
@code{bus-network.cc} located in the @code{tutorial} directory. The
|
||||
interesting code is,
|
||||
|
||||
@verbatim
|
||||
@@ -1058,7 +1058,7 @@ In the next part of the tutorial we are going to drop down a level and begin
|
||||
examining the lower levels of the system in more detail. We are going to
|
||||
explain how to change the behavior of the system and eventually how to write
|
||||
new models and applications. This is a good time to make sure that you
|
||||
thorougly understand what we've gone over so far.
|
||||
thoroughly understand what we've gone over so far.
|
||||
|
||||
@c ========================================================================
|
||||
@c Object Model
|
||||
@@ -1365,7 +1365,7 @@ its aggregation via the method @code{GetObject}.
|
||||
Technically, the class named @code{Object} is simply a base class that you
|
||||
will inherit from if you want your @code{Objects} to support aggregation and
|
||||
discovery. Many systems have a base class that implements common
|
||||
functionality and these base classes are typically called somthing like
|
||||
functionality and these base classes are typically called something like
|
||||
Object. The @command{ns-3} version of this base class relates primarily to
|
||||
@code{Object} aggregation and discovery, although it does also provide methods
|
||||
to help with intrusive reference counting and tracing as well.
|
||||
@@ -1383,7 +1383,7 @@ rather than with the form of the class declaration.
|
||||
For those of you unfamiliar with Microsoft COM, CORBA or ORBit, this might
|
||||
sound obvious. For those of with such a background, the point we are making
|
||||
is that there is no such thing in @command{ns-3} as a separate Interface
|
||||
declaration, no such thing as an Interface Definiition Language, no such thing
|
||||
declaration, no such thing as an Interface Definition Language, no such thing
|
||||
as a UUID or GUID, etc. In @command{ns-3} we just work with C++ objects that
|
||||
may be given some very useful abilities by inheriting from the @command{ns-3}
|
||||
base class @code{Object}. @command{Ns-3} @code{Objects} are not required to
|
||||
@@ -1422,7 +1422,7 @@ mentioned that the @code{Node} class acts as a container. In fact, the
|
||||
@code{Object}. So, when the @code{Node} object is created it is really an
|
||||
aggregation of one @code{Object} and you can call @code{AggregateObject} or
|
||||
@code{GetObject} on the resulting @code{Node} object. Along with being an
|
||||
aggregation, the @code{Node} class also describes a public interface. THis
|
||||
aggregation, the @code{Node} class also describes a public interface. This
|
||||
public interface (API) is declared just as any C++ object is declared, via its
|
||||
class methods as specified in the inheritance tree. For those steeped in
|
||||
COM or CORBA, this is where the concept of Interface works in @command{ns-3}.
|
||||
@@ -1531,7 +1531,7 @@ The right hand side illustrates how @code{GetObject} is acutally used.
|
||||
The method @code{GetObject} is templated. The assocated template parameter
|
||||
(between the brackets) specifies the @emph{class} that is being requested.
|
||||
This is important. Since it is the class type that specifies the search
|
||||
criteron, there can be only one instance of a particular class present in an
|
||||
criterion, there can be only one instance of a particular class present in an
|
||||
aggregation. Looking back a little, although the parameter to
|
||||
@code{AggregateObject} appears to be a vanilla C++ object (@code{b} or @code{c}
|
||||
above), it actually represents (is an instance of) a class that has an
|
||||
@@ -1648,7 +1648,7 @@ If you can get to @code{Object B} from @code{Object A}, and you can get to
|
||||
@cindex TypeId
|
||||
@cindex GetTypeId
|
||||
The final piece of this puzzle is the @code{TypeId}. Recall that the
|
||||
declaration our eample object above included the following code
|
||||
declaration our example object above included the following code
|
||||
|
||||
@verbatim
|
||||
static ns3::TypeId GetTypeId (void)
|
||||
|
||||
@@ -72,7 +72,7 @@ For Internet nodes, the ASCII trace wrapper is a wrapper around
|
||||
the @command{ns-3} low-level
|
||||
tracing system that lets you get access to underlying trace events easily.
|
||||
The output of a trace of a simulation run is an ASCII file --- thus the name.
|
||||
In the spririt of keeping things simple, you won't be able to control or
|
||||
In the spirit of keeping things simple, you won't be able to control or
|
||||
configure the output at this stage.
|
||||
|
||||
For those familiar with @command{ns-2} output, this type of trace is
|
||||
@@ -191,7 +191,7 @@ is created it is given an identifying number that monotonically increases from
|
||||
zero. Therefore, @code{nodeid=0} means that the node in which the given trace
|
||||
event originated is the first node we created. In the case of our script,
|
||||
this first node is is the node pointed to by the smart pointer @code{n0}. Not
|
||||
too surpsisingly, this is also the node to which we attached the
|
||||
too surprisingly, this is also the node to which we attached the
|
||||
@code{UdpEchoClient}. The device number is local to each node, and so the
|
||||
device given by @code{device=0} is the first net device that we added to the
|
||||
node in question. In our simulation, this corresponds to the
|
||||
@@ -339,7 +339,7 @@ one has received the UDP echo packet and the @code{UdpEchoServer Application}
|
||||
on that node has turned the packet around. Just as node zero needed to ARP
|
||||
for the MAC address of node one, now node one must ARP for the MAC address of
|
||||
node zero. We see the ARP request enqueued on the transmit queue of node one;
|
||||
then we see the ARP request dequeued from the tranmit queue of node one (and
|
||||
then we see the ARP request dequeued from the transmit queue of node one (and
|
||||
implicitly transmitted to node zero). Then we see an ARP response enqueued
|
||||
on the transmit queue of node zero; and finally the ARP response dequeued (and
|
||||
implicitly transmitted back to node one).
|
||||
@@ -396,7 +396,7 @@ tcpdump and Wireshark can be used..
|
||||
The code used to enable pcap tracing is similar to that for ASCII tracing.
|
||||
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:
|
||||
trace wrapper definitions:
|
||||
|
||||
@verbatim
|
||||
#include "ns3/pcap-trace.h"
|
||||
@@ -447,7 +447,7 @@ those nodes.
|
||||
|
||||
@subsubsection Reading output with Wireshark
|
||||
@cindex Wireshark
|
||||
If you are unfamilar with Wireshark, there is a web site available from which
|
||||
If you are unfamiliar with Wireshark, there is a web site available from which
|
||||
you can download programs and documentation: @uref{http://www.wireshark.org/}.
|
||||
|
||||
If you have Wireshark available, you can open each of the trace files and
|
||||
|
||||
Reference in new issue
Block a user