tutorial/tutorial-linear-dumbbell.cc
author Craig Dowell <craigdo@ee.washington.edu>
Tue, 09 Oct 2007 18:02:32 -0700
changeset 1843 1267bcc23b04
parent 1839 0c65f73153ea
child 2230 9f13ac3291e0
permissions -rw-r--r--
tutorial topologies
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * This program is free software; you can redistribute it and/or modify
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 * it under the terms of the GNU General Public License version 2 as
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * published by the Free Software Foundation;
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 *
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * This program is distributed in the hope that it will be useful,
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * GNU General Public License for more details.
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 *
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * You should have received a copy of the GNU General Public License
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 * along with this program; if not, write to the Free Software
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 */
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
#include "ns3/log.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
#include "ns3/ptr.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
#include "ns3/internet-node.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
#include "ns3/point-to-point-channel.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
#include "ns3/csma-channel.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
#include "ns3/mac48-address.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
#include "ns3/point-to-point-net-device.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
#include "ns3/csma-net-device.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
#include "ns3/point-to-point-topology.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
#include "ns3/csma-topology.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
#include "ns3/csma-ipv4-topology.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
#include "ns3/udp-echo-client.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
#include "ns3/udp-echo-server.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
#include "ns3/simulator.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
#include "ns3/nstime.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
#include "ns3/ascii-trace.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
#include "ns3/pcap-trace.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
#include "ns3/global-route-manager.h"
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    36
NS_LOG_COMPONENT_DEFINE ("DumbbellSimulation");
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
using namespace ns3;
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    40
// Network topology
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    41
//
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
//                       point to point
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
//                      +--------------+
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
//                      |              |
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
//       n0   n1   n2   n3             n4   n5   n6   n7
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    46
//       |    |    |    |              |    |    |    |
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
//       ================              ================
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    48
//             lan1                          lan2
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
//
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    50
int 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
main (int argc, char *argv[])
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    52
{
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    53
  LogComponentEnable ("DumbbellSimulation", LOG_LEVEL_INFO);
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    54
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    55
  NS_LOG_INFO ("Dumbbell Topology Simulation");
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
    56
//
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
    57
// Create the lan on the left side of the dumbbell.
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
    58
//
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    59
  Ptr<Node> n0 = Create<InternetNode> ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    60
  Ptr<Node> n1 = Create<InternetNode> ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    61
  Ptr<Node> n2 = Create<InternetNode> ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    62
  Ptr<Node> n3 = Create<InternetNode> ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    63
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    64
  Ptr<CsmaChannel> lan1 = 
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    65
    CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2));
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    66
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    67
  uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan1, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    68
    "08:00:2e:00:00:00");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    69
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    70
  uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan1, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    71
    "08:00:2e:00:00:01");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    72
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    73
  uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    74
    "08:00:2e:00:00:02");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    75
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    76
  uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    77
    "08:00:2e:00:00:03");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    78
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    79
  CsmaIpv4Topology::AddIpv4Address (n0, nd0, "10.1.1.1", "255.255.255.0");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    80
  CsmaIpv4Topology::AddIpv4Address (n1, nd1, "10.1.1.2", "255.255.255.0");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    81
  CsmaIpv4Topology::AddIpv4Address (n2, nd2, "10.1.1.3", "255.255.255.0");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    82
  CsmaIpv4Topology::AddIpv4Address (n3, nd3, "10.1.1.4", "255.255.255.0");
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
    83
//
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
    84
// Create the lan on the right side of the dumbbell.
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
    85
//
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    86
  Ptr<Node> n4 = Create<InternetNode> ();
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    87
  Ptr<Node> n5 = Create<InternetNode> ();
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    88
  Ptr<Node> n6 = Create<InternetNode> ();
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    89
  Ptr<Node> n7 = Create<InternetNode> ();
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    90
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    91
  Ptr<CsmaChannel> lan2 = 
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
    92
    CsmaTopology::CreateCsmaChannel (DataRate (10000000), MilliSeconds (2));
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    93
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    94
  uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan2, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    95
    "08:00:2e:00:00:04");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    96
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    97
  uint32_t nd5 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, lan2, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    98
    "08:00:2e:00:00:05");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    99
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   100
  uint32_t nd6 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n6, lan2, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   101
    "08:00:2e:00:00:06");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   102
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   103
  uint32_t nd7 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n7, lan2, 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   104
    "08:00:2e:00:00:07");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   105
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   106
  CsmaIpv4Topology::AddIpv4Address (n4, nd4, "10.1.2.1", "255.255.255.0");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   107
  CsmaIpv4Topology::AddIpv4Address (n5, nd5, "10.1.2.2", "255.255.255.0");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   108
  CsmaIpv4Topology::AddIpv4Address (n6, nd6, "10.1.2.3", "255.255.255.0");
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   109
  CsmaIpv4Topology::AddIpv4Address (n7, nd7, "10.1.2.4", "255.255.255.0");
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   110
//
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   111
// Create the point-to-point link to connect the two lans.
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   112
//
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   113
  Ptr<PointToPointChannel> link = PointToPointTopology::AddPointToPointLink (
1539
69d32521f6b8 tutorial
Craig Dowell <craigdo@ee.washington.edu>
parents: 1529
diff changeset
   114
    n3, n4, DataRate (38400), MilliSeconds (20));
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   115
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   116
  PointToPointTopology::AddIpv4Addresses (link, n3, "10.1.3.1", 
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   117
    n4, "10.1.3.2");
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   118
//
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   119
// Create data flows across the link:
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   120
//   n0 ==> n4 ==> n0
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   121
//   n1 ==> n5 ==> n1
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   122
//   n2 ==> n6 ==> n2
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   123
//   n3 ==> n7 ==> n3
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   124
//
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   125
  uint16_t port = 7;
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   126
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   127
  Ptr<UdpEchoClient> client0 = Create<UdpEchoClient> (n0, "10.1.2.1", port, 
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   128
    100, Seconds(.01), 1024);
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   129
  Ptr<UdpEchoClient> client1 = Create<UdpEchoClient> (n1, "10.1.2.2", port, 
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   130
    100, Seconds(.01), 1024);
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   131
  Ptr<UdpEchoClient> client2 = Create<UdpEchoClient> (n2, "10.1.2.3", port, 
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   132
    100, Seconds(.01), 1024);
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   133
  Ptr<UdpEchoClient> client3 = Create<UdpEchoClient> (n3, "10.1.2.4", port, 
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   134
    100, Seconds(.01), 1024);
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   135
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   136
  Ptr<UdpEchoServer> server4 = Create<UdpEchoServer> (n4, port);
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   137
  Ptr<UdpEchoServer> server5 = Create<UdpEchoServer> (n5, port);
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   138
  Ptr<UdpEchoServer> server6 = Create<UdpEchoServer> (n6, port);
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   139
  Ptr<UdpEchoServer> server7 = Create<UdpEchoServer> (n7, port);
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   140
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   141
  server4->Start(Seconds(1.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   142
  server5->Start(Seconds(1.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   143
  server6->Start(Seconds(1.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   144
  server7->Start(Seconds(1.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   145
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   146
  client0->Start(Seconds(2.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   147
  client1->Start(Seconds(2.1));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   148
  client2->Start(Seconds(2.2));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   149
  client3->Start(Seconds(2.3));
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   150
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   151
  server4->Stop (Seconds(10.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   152
  server5->Stop (Seconds(10.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   153
  server6->Stop (Seconds(10.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   154
  server7->Stop (Seconds(10.));
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   155
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   156
  client0->Stop (Seconds(10.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   157
  client1->Stop (Seconds(10.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   158
  client2->Stop (Seconds(10.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   159
  client3->Stop (Seconds(10.));
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   160
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   161
  AsciiTrace asciitrace ("tutorial.tr");
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   162
  asciitrace.TraceAllQueues ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   163
  asciitrace.TraceAllNetDeviceRx ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   164
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1839
diff changeset
   165
  PcapTrace pcaptrace ("tutorial.pcap");
1529
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   166
  pcaptrace.TraceAllIp ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   167
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   168
  GlobalRouteManager::PopulateRoutingTables ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   169
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   170
  Simulator::Run ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   171
  Simulator::Destroy ();
042ae54d795c tutorial files
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   172
}