author | Craig Dowell <craigdo@ee.washington.edu> |
Wed, 17 Dec 2008 12:17:17 -0800 | |
changeset 4028 | 13c1916747f2 |
parent 4006 | e5843adc7d22 |
child 4032 | 2b675a0b3b94 |
permissions | -rw-r--r-- |
3332 | 1 |
|
2 |
@c ======================================================================== |
|
3 |
@c Begin document body here |
|
4 |
@c ======================================================================== |
|
5 |
||
6 |
@c ======================================================================== |
|
7 |
@c PART: Building Topologies |
|
8 |
@c ======================================================================== |
|
9 |
@c The below chapters are under the major heading "Building Topologies" |
|
10 |
@c This is similar to the Latex \part command |
|
11 |
@c |
|
12 |
@c ======================================================================== |
|
13 |
@c Building Topologies |
|
14 |
@c ======================================================================== |
|
15 |
@node Building Topologies |
|
16 |
@chapter Building Topologies |
|
17 |
||
18 |
@menu |
|
3344 | 19 |
* Building a Bus Network Topology:: |
20 |
* Building a Wireless Network Topology:: |
|
3332 | 21 |
@end menu |
22 |
||
23 |
@c ======================================================================== |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
24 |
@c Building a Bus Network Topology |
3332 | 25 |
@c ======================================================================== |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
26 |
@node Building a Bus Network Topology |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
27 |
@section Building a Bus Network Topology |
3332 | 28 |
|
29 |
@cindex topology |
|
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
30 |
@cindex bus network topology |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
31 |
In this section we are going to expand our mastery of @command{ns-3} network |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
32 |
devices and channels to cover an example of a bus network. @command{Ns-3} |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
33 |
provides a net device and channel we call CSMA (Carrier Sense Multiple Access). |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
34 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
35 |
The @command{ns-3} CSMA device models a simple network in the spirit of |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
36 |
Ethernet. A real Ethernet uses CSMA/CD (Carrier Sense Multiple Access with |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
37 |
Collision Detection) scheme with exponentially increasing backoff to contend |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
38 |
for the shared transmission medium. The @command{ns-3} CSMA device and |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
39 |
channel models only a subset of this. |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
40 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
41 |
Just as we have seen point-to-point topology helper objects when constructing |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
42 |
point-to-point topologies, we will see equivalent CSMA topology helpers in |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
43 |
this section. The appearance and operation of these helpers should look |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
44 |
quite familiar to you. |
3332 | 45 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
46 |
We provide an example script in our @code{examples} directory. This script |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
47 |
builds on the @code{first.cc} script and adds a CSMA network to the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
48 |
point-to-point simulation we've already considered. Go ahead and open |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
49 |
@code{examples/second.cc} in your favorite editor. You will have already seen |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
50 |
enough @command{ns-3} code to understand most of what is going on in this |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
51 |
example, but we will go over the entire script and examine some of the output. |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
52 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
53 |
Just as in the @code{first.cc} example (and in all ns-3 examples) the file |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
54 |
begins with an emacs mode line and some GPL boilerplate. |
3332 | 55 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
56 |
One thing that can be surprisingly useful is a small bit of ASCII art that |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
57 |
shows a cartoon of the network topology constructed in the example. You will |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
58 |
find a similar ``drawing'' in most of our examples. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
59 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
60 |
In this case, you can see that we are going to extend our point-to-point |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
61 |
example (the link between the nodes n0 and n1 below) by hanging a bus network |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
62 |
off of the right side. Notice that this is the default network topology |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
63 |
since you can actually vary the number of nodes created on the LAN. If you |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
64 |
set nCsma to one, there will be a total of two nodes on the LAN (CSMA |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
65 |
channel) --- one required node and one ``extra'' node. By default there are |
3771
21f40ccb03b3
tutorial typos fixed (bug 379)
Tom Henderson <tomh@tomh.org>
parents:
3700
diff
changeset
|
66 |
three ``extra'' nodes as seen below: |
3332 | 67 |
|
68 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
69 |
// Default Network Topology |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
70 |
// |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
71 |
// 10.1.1.0 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
72 |
// n0 -------------- n1 n2 n3 n4 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
73 |
// point-to-point | | | | |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
74 |
// ================ |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
75 |
// LAN 10.1.2.0 |
3332 | 76 |
@end verbatim |
77 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
78 |
The actual code begins by loading module include files just as was done in the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
79 |
@code{first.cc} example. Then the ns-3 namespace is @code{used} and a logging |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
80 |
component is defined. This is all just as it was in @code{first.cc}, so there |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
81 |
is nothing new yet. |
3332 | 82 |
|
83 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
84 |
#include "ns3/core-module.h" |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
85 |
#include "ns3/simulator-module.h" |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
86 |
#include "ns3/node-module.h" |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
87 |
#include "ns3/helper-module.h" |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
88 |
#include "ns3/global-routing-module.h" |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
89 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
90 |
using namespace ns3; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
91 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
92 |
NS_LOG_COMPONENT_DEFINE ("SecondScriptExample"); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
93 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
94 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
95 |
The main program begins by enabling the @code{UdpEchoClientApplication} and |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
96 |
@code{UdpEchoServerApplication} logging components at @code{INFO} level so |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
97 |
we can see some output when we run the example. This should be entirely |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
98 |
familiar to you so far. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
99 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
100 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
101 |
int |
3332 | 102 |
main (int argc, char *argv[]) |
103 |
{ |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
104 |
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
105 |
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); |
3332 | 106 |
@end verbatim |
107 |
||
4028
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
108 |
A fixed seed is provided to the random number generators so that they will |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
109 |
generate repeatable results. |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
110 |
|
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
111 |
@verbatim |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
112 |
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8); |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
113 |
@end verbatim |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
114 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
115 |
Next, you will see some familiar code that will allow you to change the number |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
116 |
of devices on the CSMA network via command line argument. We did something |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
117 |
similar when we allowed the number of packets sent to be changed in the section |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
118 |
on command line arguments. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
119 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
120 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
121 |
uint32_t nCsma = 3; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
122 |
CommandLine cmd; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
123 |
cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
124 |
cmd.Parse (argc,argv); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
125 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
126 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
127 |
The next step is to create two nodes that we will connect via the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
128 |
point-to-point link. The @code{NodeContainer} is used to do this just as was |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
129 |
done in @code{first.cc}. |
3332 | 130 |
|
131 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
132 |
NodeContainer p2pNodes; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
133 |
p2pNodes.Create (2); |
3332 | 134 |
@end verbatim |
135 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
136 |
Next, we delare another @code{NodeContainer} to hold the nodes that will be |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
137 |
part of the bus (CSMA) network. First, we just instantiate the container |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
138 |
object itself. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
139 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
140 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
141 |
NodeContainer csmaNodes; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
142 |
csmaNodes.Add (p2pNodes.Get (1)); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
143 |
csmaNodes.Create (nCsma); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
144 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
145 |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3349
diff
changeset
|
146 |
The next line of code @code{Gets} the first node (as in having an index of one) |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
147 |
from the point-to-point node container and adds it to the container of nodes |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
148 |
that will get CSMA devices. The node in question is going to end up with a |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
149 |
point-to-point device @emph{and} a CSMA device. We then create a number of |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
150 |
``extra'' nodes that compose the remainder of the CSMA network. |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
151 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
152 |
The next bit of code should be quite familiar by now. We instantiate a |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
153 |
@code{PointToPointHelper} and set the associated default attributes so that |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
154 |
we create a five megabit per second transmitter on devices created using the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
155 |
helper and a two millisecond delay on channels created by the helper. |
3332 | 156 |
|
157 |
@verbatim |
|
158 |
PointToPointHelper pointToPoint; |
|
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
159 |
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
160 |
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms")); |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
161 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
162 |
NetDeviceContainer p2pDevices; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
163 |
p2pDevices = pointToPoint.Install (p2pNodes); |
3332 | 164 |
@end verbatim |
165 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
166 |
We then instantiate a @code{NetDeviceContainer} to keep track of the |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
167 |
point-to-point net devices and we @code{Install} devices on the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
168 |
point-to-point nodes. |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
169 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
170 |
We mentioned above that you were going to see a helper for CSMA devices and |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
171 |
channels, and the next lines introduce them. The @code{CsmaHelper} works just |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
172 |
like a @code{PointToPointHelper}, but it creates and connects CSMA devices and |
3995
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
173 |
channels. In the case of a CSMA device and channel pair, notice that the data |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
174 |
rate is specified by a @em{channel} attribute instead of a device attribute. |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
175 |
This is because a real CSMA network does not allow one to mix, for example, |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
176 |
10Base-T and 100Base-T devices on a given channel. We first set the data rate |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
177 |
to 100 megabits per second, and then set the speed-of-light delay of the channel |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
178 |
to 6560 nano-seconds (arbitrarily chosen as 1 nanosecond per foot over a 100 |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
179 |
meter segment). Notice that you can set an attribute using its native data |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
180 |
type. |
3332 | 181 |
|
182 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
183 |
CsmaHelper csma; |
3995
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
184 |
csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps")); |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
185 |
csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560))); |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
186 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
187 |
NetDeviceContainer csmaDevices; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
188 |
csmaDevices = csma.Install (csmaNodes); |
3332 | 189 |
@end verbatim |
190 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
191 |
Just as we created a @code{NetDeviceContainer} to hold the devices created by |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
192 |
the @code{PointToPointHelper} we create a @code{NetDeviceContainer} to hold |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
193 |
the devices created by our @code{CsmaHelper}. We call the @code{Install} |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
194 |
method of the @code{CsmaHelper} to install the devices into the nodes of the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
195 |
@code{csmaNodes NodeContainer}. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
196 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
197 |
We now have our nodes, devices and channels created, but we have no protocol |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
198 |
stacks present. Just as in the @code{first.cc} script, we will use the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
199 |
@code{InternetStackHelper} to install these stacks. |
3332 | 200 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
201 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
202 |
InternetStackHelper stack; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
203 |
stack.Install (p2pNodes.Get (0)); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
204 |
stack.Install (csmaNodes); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
205 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
206 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
207 |
Recall that we took one of the nodes from the @code{p2pNodes} container and |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
208 |
added it to the @code{csmaNodes} container. Thus we only need to install |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
209 |
the stacks on the remaining @code{p2pNodes} node, and all of the nodes in the |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
210 |
@code{csmaNodes} container to cover all of the nodes in the simulation. |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
211 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
212 |
Just as in the @code{first.cc} example script, we are going to use the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
213 |
@code{Ipv4AddressHelper} to assign IP addresses to our device interfaces. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
214 |
First we use the network 10.1.1.0 to create the two addresses needed for our |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
215 |
two point-to-point devices. |
3332 | 216 |
|
217 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
218 |
Ipv4AddressHelper address; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
219 |
address.SetBase ("10.1.1.0", "255.255.255.0"); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
220 |
Ipv4InterfaceContainer p2pInterfaces; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
221 |
p2pInterfaces = address.Assign (p2pDevices); |
3332 | 222 |
@end verbatim |
223 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
224 |
Recall that we save the created interfaces in a container to make it easy to |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
225 |
pull out addressing information later for use in setting up the applications. |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
226 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
227 |
We now need to assign IP addresses to our CSMA device interfaces. The |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
228 |
operation works just as it did for the point-to-point case, except we now |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
229 |
are performing the operation on a container that has a variable number of |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
230 |
CSMA devices --- remember we made the number of CSMA devices changeable by |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
231 |
command line argument. The CSMA devices will be associated with IP addresses |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
232 |
from network number 10.1.2.0 in this case, as seen below. |
3332 | 233 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
234 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
235 |
address.SetBase ("10.1.2.0", "255.255.255.0"); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
236 |
Ipv4InterfaceContainer csmaInterfaces; |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
237 |
csmaInterfaces = address.Assign (csmaDevices); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
238 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
239 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
240 |
Now we have a topology built, but we need applications. This section is |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
241 |
going to be fundamentally similar to the applications section of |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
242 |
@code{first.cc} but we are going to instantiate the server on one of the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
243 |
nodes that has a CSMA node and the client on the node having only a |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
244 |
point-to-point device. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
245 |
|
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
246 |
First, we set up the echo server. We create a @code{UdpEchoServerHelper} and |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
247 |
provide a required attribute value to the constructor which is the server port |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
248 |
number. Recall that this port can be changed later using the |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
249 |
@code{SetAttribute} method if desired, but we require it to be provided to |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
250 |
the constructor. |
3332 | 251 |
|
252 |
@verbatim |
|
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
253 |
UdpEchoServerHelper echoServer (9); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
254 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
255 |
ApplicationContainer serverApps = echoServer.Install (csmaNodes.Get (nCsma)); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
256 |
serverApps.Start (Seconds (1.0)); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
257 |
serverApps.Stop (Seconds (10.0)); |
3332 | 258 |
@end verbatim |
259 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
260 |
Recall that the @code{csmaNodes NodeContainer} contains one of the |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
261 |
nodes created for the point-to-point network and @code{nCsma} ``extra'' nodes. |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
262 |
What we want to get at is the last of the ``extra'' nodes. The zeroth entry of |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
263 |
the @code{csmaNodes} container will the the point-to-point node. The easy |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
264 |
way to think of this, then, is if we create one ``extra'' CSMA node, then it |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
265 |
will be be at index one of the @code{csmaNodes} container. By induction, |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
266 |
if we create @code{nCsma} ``extra'' nodes the last one will be at index |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
267 |
@code{nCsma}. You see this exhibited in the @code{Get} of the first line of |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
268 |
code. |
3332 | 269 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
270 |
The client application is set up exactly as we did in the @code{first.cc} |
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
271 |
example script. Again, we provide required attributes to the |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
272 |
@code{UdpEchoClientHelper} in the constructor (in this case the remote address |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
273 |
and port). We tell the client to send packets to the server we just installed |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
274 |
on the last of the ``extra'' CSMA nodes. We install the client on the |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
275 |
leftmost point-to-point node seen in the topology illustration. |
3332 | 276 |
|
277 |
@verbatim |
|
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
278 |
UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
279 |
echoClient.SetAttribute ("MaxPackets", UintegerValue (1)); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
280 |
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.))); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
281 |
echoClient.SetAttribute ("PacketSize", UintegerValue (1024)); |
3332 | 282 |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
283 |
ApplicationContainer clientApps = echoClient.Install (p2pNodes.Get (0)); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
284 |
clientApps.Start (Seconds (2.0)); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
285 |
clientApps.Stop (Seconds (10.0)); |
3332 | 286 |
@end verbatim |
287 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
288 |
Since we have actually built an internetwork here, we need some form of |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
289 |
internetwork routing. @command{Ns-3} provides what we call a global route |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
290 |
manager to set up the routing tables on nodes. This route manager has a |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
291 |
global function that runs though the nodes created for the simulation and does |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
292 |
the hard work of setting up routing for you. |
3332 | 293 |
|
294 |
Basically, what happens is that each node behaves as if it were an OSPF router |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
295 |
that communicates instantly and magically with all other routers behind the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
296 |
scenes. Each node generates link advertisements and communicates them |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
297 |
directly to a global route manager which uses this global information to |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
298 |
construct the routing tables for each node. Setting up this form of routing |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
299 |
is a one-liner: |
3332 | 300 |
|
301 |
@verbatim |
|
302 |
GlobalRouteManager::PopulateRoutingTables (); |
|
303 |
@end verbatim |
|
304 |
||
305 |
The remainder of the script should be very familiar to you. We just enable |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
306 |
pcap tracing, run the simulation and exit the script. Notice that enabling |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
307 |
pcap tracing using the CSMA helper is done in the same way as for the pcap |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
308 |
tracing with the point-to-point helper. |
3332 | 309 |
|
310 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
311 |
PointToPointHelper::EnablePcapAll ("second"); |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
312 |
CsmaHelper::EnablePcapAll ("second"); |
3332 | 313 |
|
314 |
Simulator::Run (); |
|
315 |
Simulator::Destroy (); |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
316 |
return 0; |
3332 | 317 |
} |
318 |
@end verbatim |
|
319 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
320 |
In order to run this example, you have to copy the @code{second.cc} example |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
321 |
script into the scratch directory and use Waf to build just as you did with |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
322 |
the @code{first.cc} example. If you are in the top-level directory of the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
323 |
repository you would type, |
3332 | 324 |
|
325 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
326 |
cp examples/second.cc scratch/ |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
327 |
./waf |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
328 |
./waf --run scratch/second |
3332 | 329 |
@end verbatim |
330 |
||
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
331 |
Since we have set up the UDP echo applications to log just as we did in |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
332 |
@code{first.cc}, you will see similar output when you run the script. |
3332 | 333 |
|
334 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
335 |
~/repos/ns-3-dev > ./waf --run scratch/second |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
336 |
Entering directory `/home/craigdo/repos/ns-3-dev/build' |
3332 | 337 |
Compilation finished successfully |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
338 |
Sent 1024 bytes to 10.1.2.4 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
339 |
Received 1024 bytes from 10.1.1.1 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
340 |
Received 1024 bytes from 10.1.2.4 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
341 |
~/repos/ns-3-dev > |
3332 | 342 |
@end verbatim |
343 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
344 |
Recall that the first message, @code{Sent 1024 bytes to 10.1.2.4} is the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
345 |
UDP echo client sending a packet to the server. In this case, the server |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
346 |
is on a different network (10.1.2.0). The second message, @code{Received 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
347 |
bytes from 10.1.1.1}, is from the UDP echo server, generated when it receives |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
348 |
the echo packet. The final message, @code{Received 1024 bytes from 10.1.2.4} |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
349 |
is from the echo client, indicating that it has received its echo back from |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
350 |
the server. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
351 |
|
3332 | 352 |
If you now go and look in the top level directory, you will find a number of |
353 |
trace files: |
|
354 |
||
355 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
356 |
~/repos/ns-3-dev > ls *.pcap |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
357 |
second-0-0.pcap second-1-1.pcap second-3-0.pcap |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
358 |
second-1-0.pcap second-2-0.pcap second-4-0.pcap |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
359 |
~/repos/ns-3-dev > |
3332 | 360 |
@end verbatim |
361 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
362 |
Let's take a moment to look at the naming of these files. They all have the |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
363 |
same form, @code{<name>-<node>-<device>.pcap}. For example, the first file |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
364 |
in the listing is @code{second-0-0.pcap} which is the pcap trace from node |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
365 |
zero - device zero. There are no other devices on node zero so this is the |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
366 |
only trace from that node. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
367 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
368 |
Now look at @code{second-1-0.pcap} and @code{second-1-1.pcap}. The former is |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
369 |
the pcap trace for device zero on node one and the latter is the trace file |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
370 |
for device one on node one. If you refer back to the topology illustrration at |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
371 |
the start of the section, you will see that node one is the node that has |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
372 |
both a point-to-point device and a CSMA device, so we should expect two pcap |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
373 |
traces for that node. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
374 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
375 |
Now, let's follow the echo packet through the internetwork. First, do a |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
376 |
tcpdump of the trace file for the leftmost point-to-point node --- node zero. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
377 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
378 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
379 |
~/repos/ns-3-dev > tcpdump -r second-0-0.pcap -nn -tt |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
380 |
reading from file second-0-0.pcap, link-type PPP (PPP) |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
381 |
2.000000 IP 10.1.1.1.49153 > 10.1.2.4.9: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
382 |
2.007382 IP 10.1.2.4.9 > 10.1.1.1.49153: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
383 |
~/repos/ns-3-dev > |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
384 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
385 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
386 |
The first line of the dump indicates that the link type is PPP (point-to-point) |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
387 |
which we expect. You then see the echo packet leaving node zero via the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
388 |
device associated with IP address 10.1.1.1 headed for IP address |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
389 |
10.1.2.4 (the rightmost CSMA node). This packet will move over the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
390 |
point-to-point link and be received by the point-to-point net device on node |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
391 |
one. Let's take a look: |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
392 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
393 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
394 |
~/repos/ns-3-dev > tcpdump -r second-1-0.pcap -nn -tt |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
395 |
reading from file second-1-0.pcap, link-type PPP (PPP) |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
396 |
2.003686 IP 10.1.1.1.49153 > 10.1.2.4.9: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
397 |
2.003695 IP 10.1.2.4.9 > 10.1.1.1.49153: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
398 |
~/repos/ns-3-dev > |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
399 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
400 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
401 |
Here we see that the link type is also PPP as we would expect. You see the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
402 |
packet from IP address 10.1.1.1 headed toward 10.1.2.4 appear on this |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
403 |
interface. Now, internally to this node, the packet will be forwarded to the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
404 |
CSMA interface and we should see it pop out the other device headed for its |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
405 |
ultimate destination. Let's then look at second-1-1.pcap and see if its there. |
3332 | 406 |
|
407 |
@verbatim |
|
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
408 |
~/repos/ns-3-dev > tcpdump -r second-1-1.pcap -nn -tt |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
409 |
reading from file second-1-1.pcap, link-type EN10MB (Ethernet) |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
410 |
2.003686 arp who-has 10.1.2.4 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
411 |
2.003687 arp reply 10.1.2.4 is-at 00:00:00:00:00:06 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
412 |
2.003687 IP 10.1.1.1.49153 > 10.1.2.4.9: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
413 |
2.003691 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.4 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
414 |
2.003691 arp reply 10.1.2.1 is-at 00:00:00:00:00:03 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
415 |
2.003695 IP 10.1.2.4.9 > 10.1.1.1.49153: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
416 |
~/repos/ns-3-dev > |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
417 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
418 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
419 |
As you can see, the link type is now ``Ethernet.'' Something new has appeared, |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
420 |
though. The bus network needs @code{ARP}, the Address Resolution Protocol. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
421 |
The node knows it needs to send the packet to IP address 10.1.2.4, but it |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
422 |
doesn't know the MAC address of the corresponding node. It broadcasts on the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
423 |
CSMA network (ff:ff:ff:ff:ff:ff) asking for the device that has IP address |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
424 |
10.1.2.4. In this case, the rightmost node replies saying it is at MAC address |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
425 |
00:00:00:00:00:06. This exchange is seen in the following lines, |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
426 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
427 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
428 |
2.003686 arp who-has 10.1.2.4 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
429 |
2.003687 arp reply 10.1.2.4 is-at 00:00:00:00:00:06 |
3332 | 430 |
@end verbatim |
431 |
||
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
432 |
Then node one, device one goes ahead and sends the echo packet to the UDP echo |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
433 |
server at IP address 10.1.2.4. We can now look at the pcap trace for the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
434 |
echo server, |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
435 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
436 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
437 |
~/repos/ns-3-dev > tcpdump -r second-4-0.pcap -nn -tt |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
438 |
reading from file second-4-0.pcap, link-type EN10MB (Ethernet) |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
439 |
2.003686 arp who-has 10.1.2.4 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
440 |
2.003686 arp reply 10.1.2.4 is-at 00:00:00:00:00:06 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
441 |
2.003690 IP 10.1.1.1.49153 > 10.1.2.4.9: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
442 |
2.003690 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.4 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
443 |
2.003692 arp reply 10.1.2.1 is-at 00:00:00:00:00:03 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
444 |
2.003692 IP 10.1.2.4.9 > 10.1.1.1.49153: UDP, length 1024 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
445 |
~/repos/ns-3-dev > |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
446 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
447 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
448 |
Again, you see that the link type is ``Ethernet.'' The first two entries are |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
449 |
the ARP exchange we just explained. The third packet is the echo packet |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
450 |
being delivered to its final destination. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
451 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
452 |
The echo server turns the packet around and needs to send it back to the echo |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
453 |
client on 10.1.1.1 but it knows that this address is on another network that |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
454 |
it reaches via IP address 10.1.2.1. This is because we initialized global |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
455 |
routing and it has figured all of this out for us. But, the echo server node |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
456 |
doesn't know the MAC address of the first CSMA node, so it has to ARP for it |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
457 |
just like the first CSMA node had to do. We leave it as an exercise for you |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
458 |
to find the entries corresponding to the packet returning back on its way to |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
459 |
the client (we have already dumped the traces and you can find them in those |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
460 |
tcpdumps above. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
461 |
|
3337
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
462 |
Let's take a look at one of the CSMA nodes that wasn't involved in the packet |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
463 |
exchange: |
3336
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
464 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
465 |
@verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
466 |
~/repos/ns-3-dev > tcpdump -r second-2-0.pcap -nn -tt |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
467 |
reading from file second-2-0.pcap, link-type EN10MB (Ethernet) |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
468 |
2.003686 arp who-has 10.1.2.4 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
469 |
2.003691 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.4 |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
470 |
~/repos/ns-3-dev > |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
471 |
@end verbatim |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
472 |
|
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
473 |
You can see that the CSMA channel is a broadcast medium and so all of the |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
474 |
devices see the ARP requests involved in the packet exchange. The remaining |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
475 |
pcap trace will be identical to this one. |
1bb6f018fc42
work through second tutorial example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3332
diff
changeset
|
476 |
|
3337
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
477 |
Finally, recall that we added the ability to control the number of CSMA devices |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
478 |
in the simulation by command line argument. You can change this argument in |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
479 |
the same way as when we looked at changing the number of packets echoed in the |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
480 |
@code{first.cc} example. Try setting the number of ``extra'' devices to four: |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
481 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
482 |
@verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
483 |
~/repos/ns-3-dev > ./waf --run "scratch/second --nCsma=4" |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
484 |
Entering directory `/home/craigdo/repos/ns-3-dev/build' |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
485 |
Compilation finished successfully |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
486 |
Sent 1024 bytes to 10.1.2.5 |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
487 |
Received 1024 bytes from 10.1.1.1 |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
488 |
Received 1024 bytes from 10.1.2.5 |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
489 |
~/repos/ns-3-dev > |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
490 |
@end verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
491 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
492 |
Notice that the echo server has now been relocated to the last of the CSMA |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
493 |
nodes, which is 10.1.2.5 instead of the default case, 10.1.2.4. You can |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
494 |
increase the number to your hearts content, but remember that you will get a |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
495 |
pcap trace file for every node in the simulation. One thing you can do to |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
496 |
keep from getting all of those pcap traces with nothing but ARP exchanges in |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
497 |
them is to be more specific about which nodes and devices you want to trace. |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
498 |
|
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
499 |
Let's take a look at @code{scratch/second.cc} and add that code enabling us |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
500 |
to be more specific. The file we provided used the @code{EnablePcapAll} |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
501 |
methods of the helpers to enable pcap on all devices. We now want to use the |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
502 |
more specific method, @code{EnablePcap}, which takes a node number and device |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
503 |
number as parameters. Go ahead and replace the @code{EnablePcapAll} calls |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
504 |
with the calls below. |
3337
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
505 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
506 |
@verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
507 |
PointToPointHelper::EnablePcap ("second", p2pNodes.Get (0)->GetId (), 0); |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
508 |
CsmaHelper::EnablePcap ("second", csmaNodes.Get (nCsma)->GetId (), 0); |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
509 |
@end verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
510 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
511 |
We know that we want to create a pcap file with the base name "second" and |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
512 |
we also know that the device of interest in both cases is going to be zero, |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
513 |
so those parameters are not really interesting. In order to get the node |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
514 |
number, you have two choices: first, nodes are numbered in a monotonically |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
515 |
increasing fashion starting from zero in the order in which you created them. |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
516 |
One way to get a node number is to figure this number out ``manually'' by |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
517 |
contemplating the order of node creation. If you take a look at the network |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
518 |
topology illustration at the beginning of the file, we did this for you and |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
519 |
you can see that the last CSMA node is going to be node number |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
520 |
@code{nCsma + 1}. This approach can become annoyingly difficult in larger |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
521 |
simulations. |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
522 |
|
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
523 |
An alternate way, which we use here, is to realize that the |
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3349
diff
changeset
|
524 |
@code{NodeContainers} contain pointers to @command{ns-3} @code{Node} Objects. |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
525 |
The @code{Node} Object has a method called @code{GetId} which will return that |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
526 |
node's ID, which is the node number we seek. Let's go take a look at the |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
527 |
Doxygen for the @code{Node} and locate that method, which is further down in |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
528 |
the @command{ns-3} core code than we've seen so far; but sometimes you have to |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
529 |
search diligently for useful things. |
3337
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
530 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
531 |
Go to the Doxygen documentation for your release (recall that you can find it |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
532 |
on the project web site). You can get to the @code{Node} documentation by |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
533 |
looking through at the ``Classes'' tab and scrolling down the ``Class List'' |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
534 |
until you find @code{ns3::Node}. Select @code{ns3::Node} and you will be taken |
3337
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
535 |
to the documentation for the @code{Node} class. If you now scroll down to the |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
536 |
@code{GetId} method and select it, you will be taken to the detailed |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
537 |
documentation for the method. Using the @code{GetId} method can make |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
538 |
determining node numbers much easier in complex topologies. |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
539 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
540 |
Now that we have got some trace filtering in place, it is reasonable to start |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
541 |
increasing the number of CSMA devices in our simulation. If you build the |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
542 |
new script and run the simulation setting @code{nCsma} to 100, you will see |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
543 |
the following output: |
3337
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
544 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
545 |
@verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
546 |
~/repos/ns-3-dev > ./waf --run "scratch/second --nCsma=100" |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
547 |
Entering directory `/home/craigdo/repos/ns-3-dev/build' |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
548 |
Compilation finished successfully |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
549 |
Sent 1024 bytes to 10.1.2.101 |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
550 |
Received 1024 bytes from 10.1.1.1 |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
551 |
Received 1024 bytes from 10.1.2.101 |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
552 |
~/repos/ns-3-dev > |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
553 |
@end verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
554 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
555 |
Note that the echo server is now located at 10.1.2.101 which corresponds to |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
556 |
having 100 ``extra'' CSMA nodes with the echo server on the last one. If you |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
557 |
list the pcap files in the top level directory, |
3337
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
558 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
559 |
@verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
560 |
~/repos/ns-3-dev > ls *.pcap |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
561 |
second-0-0.pcap second-101-0.pcap |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
562 |
~/repos/ns-3-dev > |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
563 |
@end verbatim |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
564 |
|
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
565 |
you will see that we have, in fact, only created two trace files. The trace |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
566 |
file @code{second-0-0.pcap} is the ``leftmost'' point-to-point device which is |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
567 |
the echo packet source. The file @code{second-101-0.pcap} corresponds to the |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
568 |
rightmost CSMA device which is where the echo server resides. |
6b297a1f231b
finish off csma tutorial example words
Craig Dowell <craigdo@ee.washington.edu>
parents:
3336
diff
changeset
|
569 |
|
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
570 |
@c ======================================================================== |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
571 |
@c Building a Wireless Network Topology |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
572 |
@c ======================================================================== |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
573 |
@node Building a Wireless Network Topology |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
574 |
@section Building a Wireless Network Topology |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
575 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
576 |
@cindex topology |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
577 |
@cindex wireless network topology |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
578 |
In this section we are going to further expand our knowledge of @command{ns-3} |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
579 |
network devices and channels to cover an example of a wireless network. |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
580 |
@command{Ns-3} provides a set of 802.11 models that attempt to provide an |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
581 |
accurate MAC-level implementation of the 802.11 specification and a |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
582 |
``not-so-slow'' PHY-level model of the 802.11a specification. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
583 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
584 |
Just as we have seen both point-to-point and CSMA topology helper objects when |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
585 |
constructing point-to-point topologies, we will see equivalent @code{Wifi} |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
586 |
topology helpers in this section. The appearance and operation of these |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
587 |
helpers should look quite familiar to you. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
588 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
589 |
We provide an example script in our @code{examples} directory. This script |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
590 |
builds on the @code{second.cc} script and adds a Wifi network. Go ahead and |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
591 |
open @code{examples/third.cc} in your favorite editor. You will have already |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
592 |
seen enough @command{ns-3} code to understand most of what is going on in |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
593 |
this example, but there are a few new things, so we will go over the entire |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
594 |
script and examine some of the output. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
595 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
596 |
Just as in the @code{second.cc} example (and in all @command{ns-3} examples) |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
597 |
the file begins with an emacs mode line and some GPL boilerplate. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
598 |
|
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
599 |
Take a look at the ASCII art (reproduced below) that shows the default network |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
600 |
topology constructed in the example. You can see that we are going to |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
601 |
further extend our example by hanging a wireless network off of the left side. |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
602 |
Notice that this is a default network topology since you can actually vary the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
603 |
number of nodes created on the wired and wireless networks. Just as in the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
604 |
@code{second.cc} script case, if you change @code{nCsma}, it will give you a |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
605 |
number of ``extra'' CSMA nodes. Similarly, you can set @code{nWifi} to |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
606 |
control how many @code{STA} (station) nodes are created in the simulation. |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
607 |
There will always be one @code{AP} (access point) node on the wireless |
3771
21f40ccb03b3
tutorial typos fixed (bug 379)
Tom Henderson <tomh@tomh.org>
parents:
3700
diff
changeset
|
608 |
network. By default there are three ``extra'' CSMA nodes and three wireless |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
609 |
@code{STA} nodes. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
610 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
611 |
The code begins by loading module include files just as was done in the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
612 |
@code{second.cc} example. There are a couple of new includes corresponding |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
613 |
to the Wifi module and the mobility module which we will discuss below. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
614 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
615 |
@verbatim |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
616 |
#include "ns3/core-module.h" |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
617 |
#include "ns3/simulator-module.h" |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
618 |
#include "ns3/node-module.h" |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
619 |
#include "ns3/helper-module.h" |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
620 |
#include "ns3/global-routing-module.h" |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
621 |
#include "ns3/wifi-module.h" |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
622 |
#include "ns3/mobility-module.h" |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
623 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
624 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
625 |
The network topology illustration follows: |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
626 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
627 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
628 |
// Default Network Topology |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
629 |
// |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
630 |
// Wifi 10.1.3.0 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
631 |
// AP |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
632 |
// * * * * |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
633 |
// | | | | 10.1.1.0 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
634 |
// n5 n6 n7 n0 -------------- n1 n2 n3 n4 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
635 |
// point-to-point | | | | |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
636 |
// ================ |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
637 |
// LAN 10.1.2.0 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
638 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
639 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
640 |
You can see that we are adding a new network device to the node on the left |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
641 |
side of the point-to-point link that becomes the access point for the wireless |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
642 |
network. A number of wireless STA nodes are created to fill out the new |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
643 |
10.1.3.0 network as shown on the left side of the illustration. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
644 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
645 |
After the illustration, the @code{ns-3} namespace is @code{used} and a logging |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
646 |
component is defined. This should all be quite familiar by now. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
647 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
648 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
649 |
using namespace ns3; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
650 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
651 |
NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample"); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
652 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
653 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
654 |
As has become the norm in this tutorial, the main program begins by enabling |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
655 |
the @code{UdpEchoClientApplication} and @code{UdpEchoServerApplication} |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
656 |
logging components at @code{INFO} level so we can see some output when we run |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
657 |
the simulation. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
658 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
659 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
660 |
int |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
661 |
main (int argc, char *argv[]) |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
662 |
{ |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
663 |
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
664 |
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
665 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
666 |
|
4028
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
667 |
A fixed seed is provided to the random number generators so that they will |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
668 |
generate repeatable results. |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
669 |
|
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
670 |
@verbatim |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
671 |
RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8); |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
672 |
@end verbatim |
13c1916747f2
fixed seeds for tutorial examples and updates to tutorial to match
Craig Dowell <craigdo@ee.washington.edu>
parents:
4006
diff
changeset
|
673 |
|
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
674 |
Next, you will see more familiar code that will allow you to change the number |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
675 |
of devices on the CSMA and Wifi networks via command line argument. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
676 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
677 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
678 |
uint32_t nCsma = 3; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
679 |
uint32_t nWifi = 3; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
680 |
CommandLine cmd; |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
681 |
cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma); |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
682 |
cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
683 |
cmd.Parse (argc,argv); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
684 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
685 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
686 |
Just as in all of the previous examples, the next step is to create two nodes |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
687 |
that we will connect via the point-to-point link. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
688 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
689 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
690 |
NodeContainer p2pNodes; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
691 |
p2pNodes.Create (2); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
692 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
693 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
694 |
Next, we see an old friend. We instantiate a @code{PointToPointHelper} and |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
695 |
set the associated default attributes so that we create a five megabit per |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
696 |
second transmitter on devices created using the helper and a two millisecond |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
697 |
delay on channels created by the helper. We then @code{Intall} the devices |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
698 |
on the nodes and the channel between them. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
699 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
700 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
701 |
PointToPointHelper pointToPoint; |
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
702 |
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps")); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
703 |
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms")); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
704 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
705 |
NetDeviceContainer p2pDevices; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
706 |
p2pDevices = pointToPoint.Install (p2pNodes); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
707 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
708 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
709 |
Next, we delare another @code{NodeContainer} to hold the nodes that will be |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
710 |
part of the bus (CSMA) network. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
711 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
712 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
713 |
NodeContainer csmaNodes; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
714 |
csmaNodes.Add (p2pNodes.Get (1)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
715 |
csmaNodes.Create (nCsma); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
716 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
717 |
|
3354
f11e4def3fc4
tweak, tweak the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3349
diff
changeset
|
718 |
The next line of code @code{Gets} the first node (as in having an index of one) |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
719 |
from the point-to-point node container and adds it to the container of nodes |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
720 |
that will get CSMA devices. The node in question is going to end up with a |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
721 |
point-to-point device and a CSMA device. We then create a number of ``extra'' |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
722 |
nodes that compose the remainder of the CSMA network. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
723 |
|
3995
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
724 |
We then instantiate a @code{CsmaHelper} and set its attributes as we did in |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
725 |
the previous example. We create a @code{NetDeviceContainer} to keep track of |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
726 |
the created CSMA net devices and then we @code{Install} CSMA devices on the |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
727 |
selected nodes. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
728 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
729 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
730 |
CsmaHelper csma; |
3995
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
731 |
csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps")); |
9bda1a9c0eb2
Add reasonable data rate and delay to csma channels; update tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3771
diff
changeset
|
732 |
csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560))); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
733 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
734 |
NetDeviceContainer csmaDevices; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
735 |
csmaDevices = csma.Install (csmaNodes); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
736 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
737 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
738 |
Next, we are going to create the nodes that will be part of the Wifi network. |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
739 |
We are going to create a number of ``station'' nodes as specified by the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
740 |
command line argument, and we are going to use the ``leftmost'' node of the |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
741 |
point-to-point link as the node for the access point. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
742 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
743 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
744 |
NodeContainer wifiStaNodes; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
745 |
wifiStaNodes.Create (nWifi); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
746 |
NodeContainer wifiApNode = p2pNodes.Get (0); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
747 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
748 |
|
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
749 |
The next bit of code constructs the wifi devices and the interconnection |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
750 |
channel between these wifi nodes. First, we configure the PHY and channel |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
751 |
helpers: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
752 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
753 |
@verbatim |
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
754 |
YansWifiChannelHelper channel = YansWifiChannelHelper::Default (); |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
755 |
YansWifiPhyHelper phy = YansWifiPhyHelper::Default (); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
756 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
757 |
|
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
758 |
For simplicity, this code uses the default PHY layer configuration and |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
759 |
channel models which are documented in the API doxygen documentation for |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
760 |
the @code{YansWifiChannelHelper::Default} and @code{YAnsWifiPhyHelper::Default} |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
761 |
methods. Once these objects are created, we create a channel object |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
762 |
and associate it to our PHY layer object manager to make sure |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
763 |
that all the PHY objects created layer by the @code{YansWifiPhyHelper} |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
764 |
all share the same underlying channel, that is, they share the same |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
765 |
wireless medium and can communication and interfere: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
766 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
767 |
@verbatim |
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
768 |
phy.SetChannel (channel.Create ()); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
769 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
770 |
|
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
771 |
Once the PHY helper is configured, we can focus on the MAC layer: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
772 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
773 |
@verbatim |
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
774 |
WifiHelper wifi = WifiHelper::Default (); |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
775 |
wifi.SetRemoteStationManager ("ns3::AarfWifiManager"); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
776 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
777 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
778 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
779 |
The @code{SetRemoteStationManager} method tells the helper the type of |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
780 |
rate control algorithm to use. Here, it is asking the helper to use the AARF |
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
781 |
algorithm --- details are, of course, available in Doxygen. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
782 |
|
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
783 |
Next, we configure the SSID of the infrastructure network we want to setup |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
784 |
and make sure that our stations don't perform active probing: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
785 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
786 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
787 |
Ssid ssid = Ssid ("ns-3-ssid"); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
788 |
wifi.SetMac ("ns3::NqstaWifiMac", |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
789 |
"Ssid", SsidValue (ssid), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
790 |
"ActiveProbing", BooleanValue (false)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
791 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
792 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
793 |
This code first creates an 802.11 service set identifier (SSID) object that |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
794 |
will be used to set the value of the ``Ssid'' @code{Attribute} of the MAC |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
795 |
layer implementation. The particular kind of MAC layer is specified by |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
796 |
@code{Attribute} as being of the "ns3::NqstaWifiMac" type. This means that |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
797 |
the MAC will use a ``non-QoS station'' (nqsta) state machine. Finally, the |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
798 |
``ActiveProbing'' attribute is set to false. This means that probe requests |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
799 |
will not be sent by MACs created by this helper. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
800 |
|
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
801 |
Once all the station-specific parameters are fully configured, both at the |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
802 |
MAC and PHY layers, we can invoke our now-familiar @code{Install} method to |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
803 |
create the wifi devices of these stations: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
804 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
805 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
806 |
NetDeviceContainer staDevices; |
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
807 |
staDevices = wifi.Install (phy, wifiStaNodes); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
808 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
809 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
810 |
We have configured Wifi for all of our STA nodes, and now we need to |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
811 |
configure the AP (access point) node. We begin this process by changing |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
812 |
the default @code{Attributes} of the @code{WifiHelper} to reflect the |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
813 |
requirements of the AP. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
814 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
815 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
816 |
wifi.SetMac ("ns3::NqapWifiMac", |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
817 |
"Ssid", SsidValue (ssid), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
818 |
"BeaconGeneration", BooleanValue (true), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
819 |
"BeaconInterval", TimeValue (Seconds (2.5))); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
820 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
821 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
822 |
In this case, the @code{WifiHelper} is going to create MAC layers of the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
823 |
``ns3::NqapWifiMac'' (Non-Qos Access Point) type. We set the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
824 |
``BeaconGeneration'' attribute to true and also set an interval between |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
825 |
beacons of 2.5 seconds. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
826 |
|
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
827 |
The next lines create the single AP which shares the same set of PHY-level |
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
828 |
attributes (and channel) as the stations: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
829 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
830 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
831 |
NetDeviceContainer apDevices; |
4006
e5843adc7d22
bug 440: update tutorial
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3995
diff
changeset
|
832 |
apDevices = wifi.Install (phy, wifiApNode); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
833 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
834 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
835 |
Now, we are going to add mobility models. We want the STA nodes to be mobile, |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
836 |
wandering around inside a bounding box, and we want to make the AP node |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
837 |
stationary. We use the @code{MobilityHelper} to make this easy for us. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
838 |
First, we instantiate a @code{MobilityHelper} obejct and set some attributes |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
839 |
controlling the ``position allocator'' functionality. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
840 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
841 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
842 |
MobilityHelper mobility; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
843 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
844 |
mobility.SetPositionAllocator ("ns3::GridPositionAllocator", |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
845 |
"MinX", DoubleValue (0.0), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
846 |
"MinY", DoubleValue (0.0), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
847 |
"DeltaX", DoubleValue (5.0), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
848 |
"DeltaY", DoubleValue (10.0), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
849 |
"GridWidth", UintegerValue (3), |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
850 |
"LayoutType", StringValue ("RowFirst")); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
851 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
852 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
853 |
This code tells the mobility helper to use a two-dimensional grid to initially |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
854 |
place the STA nodes. Feel free to explore the Doxygen for class |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
855 |
@code{ns3::GridPositionAllocator} to see exactly what is being done. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
856 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
857 |
We have aranged our nodes on an initial grid, but now we need to tell them |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
858 |
how to move. We choose the @code{RandomWalk2dMobilityModel} which has the |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
859 |
nodes move in a random direction at a random speed around inside a bounding |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
860 |
box. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
861 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
862 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
863 |
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel", |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
864 |
"Bounds", RectangleValue (Rectangle (-50, 50, -50, 50))); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
865 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
866 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
867 |
We now tell the @code{MobilityHelper} to install the mobility models on the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
868 |
STA nodes. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
869 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
870 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
871 |
mobility.Install (wifiStaNodes); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
872 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
873 |
|
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
874 |
We want the access point to remain in a fixed position during the simulation. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
875 |
We accomplish this by setting the mobility model for this node to be the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
876 |
@code{ns3::StaticMobilityModel}: |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
877 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
878 |
@verbatim |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
879 |
mobility.SetMobilityModel ("ns3::StaticMobilityModel"); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
880 |
mobility.Install (wifiApNode); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
881 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
882 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
883 |
We now have our nodes, devices and channels created, and mobility models |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
884 |
chosen for the Wifi nodes, but we have no protocol stacks present. Just as |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
885 |
we have done previously many times, we will use the @code{InternetStackHelper} |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
886 |
to install these stacks. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
887 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
888 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
889 |
InternetStackHelper stack; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
890 |
stack.Install (csmaNodes); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
891 |
stack.Install (wifiApNode); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
892 |
stack.Install (wifiStaNodes); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
893 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
894 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
895 |
Just as in the @code{second.cc} example script, we are going to use the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
896 |
@code{Ipv4AddressHelper} to assign IP addresses to our device interfaces. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
897 |
First we use the network 10.1.1.0 to create the two addresses needed for our |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
898 |
two point-to-point devices. Then we use network 10.1.2.0 to assign addresses |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
899 |
the the CSMA network and then we assign addresses from network 10.1.3.0 to |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
900 |
both the STA devices and the AP on the wireless network. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
901 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
902 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
903 |
Ipv4AddressHelper address; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
904 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
905 |
address.SetBase ("10.1.1.0", "255.255.255.0"); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
906 |
Ipv4InterfaceContainer p2pInterfaces; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
907 |
p2pInterfaces = address.Assign (p2pDevices); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
908 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
909 |
address.SetBase ("10.1.2.0", "255.255.255.0"); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
910 |
Ipv4InterfaceContainer csmaInterfaces; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
911 |
csmaInterfaces = address.Assign (csmaDevices); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
912 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
913 |
address.SetBase ("10.1.3.0", "255.255.255.0"); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
914 |
address.Assign (staDevices); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
915 |
address.Assign (apDevices); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
916 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
917 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
918 |
We put the echo server on the ``rightmost'' node in the illustration at the |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
919 |
start of the file. We have done this before. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
920 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
921 |
@verbatim |
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
922 |
UdpEchoServerHelper echoServer (9); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
923 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
924 |
ApplicationContainer serverApps = echoServer.Install (csmaNodes.Get (nCsma)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
925 |
serverApps.Start (Seconds (1.0)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
926 |
serverApps.Stop (Seconds (10.0)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
927 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
928 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
929 |
And we put the echo client on the last STA node we created, pointing it to |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
930 |
the server on the CSMA network. We have also seen similar operations before. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
931 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
932 |
@verbatim |
3382
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
933 |
UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
934 |
echoClient.SetAttribute ("MaxPackets", UintegerValue (1)); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
935 |
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.))); |
d5f8e5fae1c6
fix bug 234 which changes required methods on helpers to constructor parameters. Update tutorial content to reflect. Change RemoteIpv4 attribute to RemoteAddress.
Craig Dowell <craigdo@ee.washington.edu>
parents:
3355
diff
changeset
|
936 |
echoClient.SetAttribute ("PacketSize", UintegerValue (1024)); |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
937 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
938 |
ApplicationContainer clientApps = |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
939 |
echoClient.Install (wifiStaNodes.Get (nWifi - 1)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
940 |
clientApps.Start (Seconds (2.0)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
941 |
clientApps.Stop (Seconds (10.0)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
942 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
943 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
944 |
Since we have built an internetwork here, we need enable internetwork routing |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
945 |
just as we did in the @code{second.cc} example script. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
946 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
947 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
948 |
GlobalRouteManager::PopulateRoutingTables (); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
949 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
950 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
951 |
One thing that can surprise some users is the fact that the simulation we just |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
952 |
created will never ``naturally'' stop. This is because we asked the wireless |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
953 |
access point to generate beacons. It will generate beacons forever, so we must |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
954 |
tell the simulator to stop even though it may have beacon generation events |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
955 |
scheduled. The following line of code tells the simulator to stop so that |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
956 |
we don't simulate beacons forever and enter what is essentially an endless |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
957 |
loop. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
958 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
959 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
960 |
Simulator::Stop (Seconds (10.0)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
961 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
962 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
963 |
We use the same trick as in the @code{second.cc} script to only generate |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
964 |
pcap traces from the nodes we find interesting. Note that we use the same |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
965 |
``formula'' to get pcap tracing enabled on Wifi devices as we did on the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
966 |
CSMA and point-to-point devices. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
967 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
968 |
@verbatim |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
969 |
WifiHelper::EnablePcap ("third", |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
970 |
wifiStaNodes.Get (nWifi - 1)->GetId (), 0); |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
971 |
CsmaHelper::EnablePcap ("third", |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
972 |
csmaNodes.Get (nCsma)->GetId (), 0); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
973 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
974 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
975 |
Finally, we actually run the simulation, clean up and then exit the program. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
976 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
977 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
978 |
Simulator::Run (); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
979 |
Simulator::Destroy (); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
980 |
return 0; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
981 |
} |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
982 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
983 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
984 |
In order to run this example, you have to copy the @code{third.cc} example |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
985 |
script into the scratch directory and use Waf to build just as you did with |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
986 |
the @code{second.cc} example. If you are in the top-level directory of the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
987 |
repository you would type, |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
988 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
989 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
990 |
cp examples/third.cc scratch/ |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
991 |
./waf |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
992 |
./waf --run scratch/third |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
993 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
994 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
995 |
Since we have set up the UDP echo applications just as we did in the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
996 |
@code{second.cc} script, you will see similar output. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
997 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
998 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
999 |
~/repos/ns-3-dev > ./waf --run scratch/third |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1000 |
Entering directory `/home/craigdo/repos/ns-3-dev/build' |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1001 |
Compilation finished successfully |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1002 |
Sent 1024 bytes to 10.1.2.4 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1003 |
Received 1024 bytes from 10.1.3.3 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1004 |
Received 1024 bytes from 10.1.2.4 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1005 |
~/repos/ns-3-dev > |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1006 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1007 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1008 |
Recall that the first message, @code{Sent 1024 bytes to 10.1.2.4} is the |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1009 |
UDP echo client sending a packet to the server. In this case, the client |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1010 |
is on the wireless network (10.1.3.0). The second message, |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1011 |
@code{Received 1024 bytes from 10.1.3.3}, is from the UDP echo server, |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1012 |
generated when it receives the echo packet. The final message, |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1013 |
@code{Received 1024 bytes from 10.1.2.4} is from the echo client, indicating |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1014 |
that it has received its echo back from the server. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1015 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1016 |
If you now go and look in the top level directory, you will find two trace |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1017 |
files: |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1018 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1019 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1020 |
~/repos/ns-3-dev > ls *.pcap |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1021 |
third-4-0.pcap third-7-0.pcap |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1022 |
~/repos/ns-3-dev > |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1023 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1024 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1025 |
The file ``third-4-0.pcap'' corresponds to the pcap trace for node four - |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1026 |
device zero. This is the CSMA network node that acted as the echo server. |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1027 |
Take a look at the tcpdump for this device: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1028 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1029 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1030 |
~/repos/ns-3-dev > tcpdump -r third-4-0.pcap -nn -tt |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1031 |
reading from file third-4-0.pcap, link-type EN10MB (Ethernet) |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1032 |
2.005855 arp who-has 10.1.2.4 (ff:ff:ff:ff:ff:ff) tell 10.1.2.1 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1033 |
2.005855 arp reply 10.1.2.4 is-at 00:00:00:00:00:06 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1034 |
2.005859 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1035 |
2.005859 arp who-has 10.1.2.1 (ff:ff:ff:ff:ff:ff) tell 10.1.2.4 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1036 |
2.005861 arp reply 10.1.2.1 is-at 00:00:00:00:00:03 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1037 |
2.005861 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1038 |
~/repos/ns-3-dev > |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1039 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1040 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1041 |
This should be familiar and easily understood. If you've forgotten, go back |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1042 |
and look at the discussion in @code{second.cc}. This is the same sequence. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1043 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1044 |
Now, take a look at the other trace file, ``third-7-0.pcap.'' This is the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1045 |
trace file for the wireless STA node that acts as the echo client. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1046 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1047 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1048 |
~/repos/ns-3-dev > tcpdump -r third-7-0.pcap -nn -tt |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1049 |
reading from file third-7-0.pcap, link-type IEEE802_11 (802.11) |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1050 |
0.000146 Beacon (ns-3-ssid) ... |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1051 |
H: 0 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1052 |
0.000180 Assoc Request (ns-3-ssid) ... |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1053 |
0.000336 Acknowledgment RA:00:00:00:00:00:07 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1054 |
0.000454 Assoc Response AID(0) :: Succesful |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1055 |
0.000514 Acknowledgment RA:00:00:00:00:00:0a |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1056 |
0.000746 Assoc Request (ns-3-ssid) ... |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1057 |
0.000902 Acknowledgment RA:00:00:00:00:00:09 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1058 |
0.001020 Assoc Response AID(0) :: Succesful |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1059 |
0.001036 Acknowledgment RA:00:00:00:00:00:0a |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1060 |
0.001219 Assoc Request (ns-3-ssid) ... |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1061 |
0.001279 Acknowledgment RA:00:00:00:00:00:08 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1062 |
0.001478 Assoc Response AID(0) :: Succesful |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1063 |
0.001538 Acknowledgment RA:00:00:00:00:00:0a |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1064 |
2.000000 arp who-has 10.1.3.4 (ff:ff:ff:ff:ff:ff) tell 10.1.3.3 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1065 |
2.000172 Acknowledgment RA:00:00:00:00:00:09 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1066 |
2.000318 arp who-has 10.1.3.4 (ff:ff:ff:ff:ff:ff) tell 10.1.3.3 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1067 |
2.000581 arp reply 10.1.3.4 is-at 00:00:00:00:00:0a |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1068 |
2.000597 Acknowledgment RA:00:00:00:00:00:0a |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1069 |
2.000693 IP 10.1.3.3.49153 > 10.1.2.4.9: UDP, length 1024 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1070 |
2.002229 Acknowledgment RA:00:00:00:00:00:09 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1071 |
2.009663 arp who-has 10.1.3.3 (ff:ff:ff:ff:ff:ff) tell 10.1.3.4 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1072 |
2.009697 arp reply 10.1.3.3 is-at 00:00:00:00:00:09 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1073 |
2.009869 Acknowledgment RA:00:00:00:00:00:09 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1074 |
2.011487 IP 10.1.2.4.9 > 10.1.3.3.49153: UDP, length 1024 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1075 |
2.011503 Acknowledgment RA:00:00:00:00:00:0a |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1076 |
2.500112 Beacon[|802.11] |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1077 |
5.000112 Beacon[|802.11] |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1078 |
7.500112 Beacon[|802.11] |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1079 |
~/repos/ns-3-dev > |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1080 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1081 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1082 |
You can see that the link type is now 802.11 as you would expect. We leave |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1083 |
it as an exercise to parse the dump and trace packets across the internetwork. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1084 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1085 |
Now, we spent a lot of time setting up mobility models for the wireless network |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1086 |
and so it would be a shame to finish up without even showing that the STA |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1087 |
nodes are actually moving around. Let's do this by hooking into the |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1088 |
@code{MobilityModel} course change trace source. This is usually considered |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1089 |
a fairly advanced topic, but let's just go for it. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1090 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1091 |
As mentioned in the Tweaking Ns-3 section, the @command{ns-3} tracing system |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1092 |
is divided into trace sources and trace sinks, and we provide functions to |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1093 |
connect the two. We will use the mobility model predefined course change |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1094 |
trace source to originate the trace events. We will need to write a trace |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1095 |
sink to connect to that source that will display some pretty information for |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1096 |
us. Despite its reputation as being difficult, it's really quite simple. |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1097 |
Just before the main program of the @code{scratch/third.cc} script, add the |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1098 |
following function: |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1099 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1100 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1101 |
void |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1102 |
CourseChange (std::string context, Ptr<const MobilityModel> model) |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1103 |
{ |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1104 |
Vector position = model->GetPosition (); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1105 |
NS_LOG_UNCOND (context << |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1106 |
" x = " << position.x << ", y = " << position.y); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1107 |
} |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1108 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1109 |
|
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1110 |
This code just pulls the position information from the mobility model and |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1111 |
unconditionally logs the x and y position of the node. We are |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1112 |
going to arrange for this function to be called every time the wireless |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1113 |
node with the echo client changes its position. We do this using the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1114 |
@code{Config::Connect} function. Add the following lines of code to the |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1115 |
script just before the @code{Simulator::Run} call. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1116 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1117 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1118 |
std::ostringstream oss; |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1119 |
oss << |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1120 |
"/NodeList/" << wifiStaNodes.Get (nWifi - 1)->GetId () << |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1121 |
"/$ns3::MobilityModel/CourseChange"; |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1122 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1123 |
Config::Connect (oss.str (), MakeCallback (&CourseChange)); |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1124 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1125 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1126 |
What we do here is to create a string containing the tracing namespace path |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1127 |
of the event to which we want to connect. First, we have to figure out which |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1128 |
node it is we want using the @code{GetId} method as described earlier. In the |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1129 |
case of the default number of CSMA and wireless nodes, this turns out to be |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1130 |
node seven and the tracing namespace path to the mobility model would look |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1131 |
like, |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1132 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1133 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1134 |
/NodeList/7/$ns3::MobilityModel/CourseChange |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1135 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1136 |
|
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1137 |
Based on the discussion in the tracing section, you can easily infer that |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1138 |
this trace path references the seventh node in the NodeList. It specifies |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1139 |
what is called an aggregated object of type @code{ns3::MobilityModel}. The |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1140 |
dollar sign prefix implies that the MobilityModel is aggregated to node seven. |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1141 |
The last component of the path means that we are hooking into the |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1142 |
``CourseChange'' event of that model. |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1143 |
|
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1144 |
We make a connection between the trace source in node seven with our trace |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1145 |
sink by calling @code{Config::Connect} and passing this namespace path. Once |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1146 |
this is done, every course change event on node seven will be hooked into our |
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1147 |
trace sink, which will in turn print out the new position. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1148 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1149 |
If you now run the simulation, you will see the course changes displayed as |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1150 |
they happen. |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1151 |
|
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1152 |
@verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1153 |
~/repos/ns-3-dev > ./waf --run scratch/third |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1154 |
Entering directory `/home/craigdo/repos/ns-3-dev/build' |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1155 |
Compilation finished successfully |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1156 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 10, y = 0 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1157 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.1304, y = 0.493761 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1158 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.70417, y = 1.39837 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1159 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 7.94799, y = 2.05274 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1160 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.82597, y = 1.57404 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1161 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.3003, y = 0.723347 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1162 |
Sent 1024 bytes to 10.1.2.4 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1163 |
Received 1024 bytes from 10.1.3.3 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1164 |
Received 1024 bytes from 10.1.2.4 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1165 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.74083, y = 1.62109 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1166 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.00146, y = 0.655647 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1167 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.98731, y = 0.823279 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1168 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.50206, y = 1.69766 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1169 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.68108, y = 2.26862 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1170 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.25992, y = 1.45317 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1171 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.55655, y = 0.742346 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1172 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.21992, y = 1.68398 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1173 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.81273, y = 0.878638 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1174 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 7.83171, y = 1.07256 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1175 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 7.60027, y = 0.0997156 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1176 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.45367, y = 0.620978 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1177 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 7.68484, y = 1.26043 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1178 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.53659, y = 0.736479 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1179 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.51876, y = 0.548502 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1180 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.89778, y = 1.47389 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1181 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.98984, y = 1.893 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1182 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 9.91524, y = 1.51402 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1183 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.98761, y = 1.14054 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1184 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.16617, y = 0.570239 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1185 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.02954, y = 1.56086 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1186 |
/NodeList/7/$ns3::MobilityModel/CourseChange x = 8.09551, y = 2.55868 |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1187 |
~/repos/ns-3-dev > |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1188 |
@end verbatim |
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1189 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1190 |
If you are feeling brave, there is a list of all trace sources in the |
3700 | 1191 |
@uref{http://www.nsnam.org/doxygen-release/index.html,,ns-3 Doxygen} |
1192 |
which you can find in the ``Modules'' tab. |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1193 |
Under the ``core'' section, you will find a link to ``The list of all trace |
3355
ea06eff669b3
some final tweaks to the tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3354
diff
changeset
|
1194 |
sources.'' You may find it interesting to try and hook some of these |
3700 | 1195 |
traces yourself. Additionally in the ``Modules'' documentation, there is |
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1196 |
a link to ``The list of all attributes.'' You can set the default value of |
3700 | 1197 |
any of these attributes via the command line as we have previously discussed. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1198 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1199 |
We have just scratched the surface of @command{ns-3} in this tutorial, but we |
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1200 |
hope we have covered enough to get you started doing useful work. |
3339
ff29f4ba75ed
finish up with a wifi example
Craig Dowell <craigdo@ee.washington.edu>
parents:
3337
diff
changeset
|
1201 |
|
3349
e6259dcffada
more editing passes through tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents:
3344
diff
changeset
|
1202 |
-- The @command{ns-3} development team. |