tutorial/tutorial-star-routing.cc
author Craig Dowell <craigdo@ee.washington.edu>
Mon, 04 Feb 2008 12:56:08 -0800
changeset 2311 a7dbe3cba7de
parent 2230 9f13ac3291e0
child 2494 1c69ea12779c
permissions -rw-r--r--
tutorial now agrees with ns3-object changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1842
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * This program is free software; you can redistribute it and/or modify
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 * it under the terms of the GNU General Public License version 2 as
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * published by the Free Software Foundation;
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 *
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * This program is distributed in the hope that it will be useful,
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * GNU General Public License for more details.
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 *
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * You should have received a copy of the GNU General Public License
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 * along with this program; if not, write to the Free Software
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 */
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
#include "ns3/log.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
#include "ns3/ptr.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
#include "ns3/internet-node.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
#include "ns3/point-to-point-channel.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
#include "ns3/mac48-address.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
#include "ns3/point-to-point-net-device.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
#include "ns3/udp-echo-client.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
#include "ns3/udp-echo-server.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
#include "ns3/simulator.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
#include "ns3/nstime.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
#include "ns3/ascii-trace.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
#include "ns3/pcap-trace.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
#include "ns3/global-route-manager.h"
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
1848
5dfaf1619279 move in topo
Craig Dowell <craigdo@ee.washington.edu>
parents: 1843
diff changeset
    31
#include "point-to-point-ipv4-topology.h"
5dfaf1619279 move in topo
Craig Dowell <craigdo@ee.washington.edu>
parents: 1843
diff changeset
    32
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1842
diff changeset
    33
NS_LOG_COMPONENT_DEFINE ("StarRoutingSimulation");
1842
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
using namespace ns3;
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
// Network topology
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
//
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
//                  n3    n2
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    40
//                   |   /
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    41
//                    | /
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
//              n4 --- n0 --- n1
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
//                    /  |
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
//                   /    |
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
//                  n5    n6
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    46
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
int 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    48
main (int argc, char *argv[])
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
{
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1842
diff changeset
    50
  LogComponentEnable ("StarRoutingSimulation", LOG_LEVEL_INFO);
1842
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
1843
1267bcc23b04 tutorial topologies
Craig Dowell <craigdo@ee.washington.edu>
parents: 1842
diff changeset
    52
  NS_LOG_INFO ("Star Topology with Routing Simulation");
1842
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    53
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
    54
  Ptr<Node> n0 = CreateObject<InternetNode> ();
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
    55
  Ptr<Node> n1 = CreateObject<InternetNode> ();
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
    56
  Ptr<Node> n2 = CreateObject<InternetNode> ();
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
    57
  Ptr<Node> n3 = CreateObject<InternetNode> ();
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
    58
  Ptr<Node> n4 = CreateObject<InternetNode> ();
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
    59
  Ptr<Node> n5 = CreateObject<InternetNode> ();
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
    60
  Ptr<Node> n6 = CreateObject<InternetNode> ();
1842
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    61
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    62
  Ptr<PointToPointChannel> link01 = 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    63
    PointToPointIpv4Topology::CreateChannel (DataRate (38400), 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    64
    MilliSeconds (20));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    65
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    66
  uint32_t nd01 = PointToPointIpv4Topology::AddNetDevice (n0,
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    67
    link01);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    68
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    69
  Ptr<PointToPointChannel> link02 = 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    70
    PointToPointIpv4Topology::CreateChannel (DataRate (38400), 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    71
    MilliSeconds (20));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    72
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    73
  uint32_t nd02 = PointToPointIpv4Topology::AddNetDevice (n0,
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    74
    link02);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    75
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    76
  Ptr<PointToPointChannel> link03 = 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    77
    PointToPointIpv4Topology::CreateChannel (DataRate (38400), 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    78
    MilliSeconds (20));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    79
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    80
  uint32_t nd03 = PointToPointIpv4Topology::AddNetDevice (n0,
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    81
    link03);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    82
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    83
  Ptr<PointToPointChannel> link04 = 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    84
    PointToPointIpv4Topology::CreateChannel (DataRate (38400), 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    85
    MilliSeconds (20));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    86
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    87
  uint32_t nd04 = PointToPointIpv4Topology::AddNetDevice (n0, 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    88
    link04);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    89
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    90
  Ptr<PointToPointChannel> link05 = 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    91
    PointToPointIpv4Topology::CreateChannel (DataRate (38400), 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    92
    MilliSeconds (20));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    93
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    94
  uint32_t nd05 = PointToPointIpv4Topology::AddNetDevice (n0,
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    95
    link05);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    96
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    97
  Ptr<PointToPointChannel> link06 = 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    98
    PointToPointIpv4Topology::CreateChannel (DataRate (38400), 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    99
    MilliSeconds (20));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   100
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   101
  uint32_t nd06 = PointToPointIpv4Topology::AddNetDevice (n0, link06);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   102
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   103
  uint32_t nd1 = PointToPointIpv4Topology::AddNetDevice (n1, link01);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   104
  uint32_t nd2 = PointToPointIpv4Topology::AddNetDevice (n2, link02);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   105
  uint32_t nd3 = PointToPointIpv4Topology::AddNetDevice (n3, link03);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   106
  uint32_t nd4 = PointToPointIpv4Topology::AddNetDevice (n4, link04);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   107
  uint32_t nd5 = PointToPointIpv4Topology::AddNetDevice (n5, link05);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   108
  uint32_t nd6 = PointToPointIpv4Topology::AddNetDevice (n6, link06);
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   109
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   110
  PointToPointIpv4Topology::AddAddress (n0, nd01, "10.1.1.1", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   111
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   112
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   113
  PointToPointIpv4Topology::AddAddress (n1, nd1, "10.1.1.2", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   114
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   115
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   116
  PointToPointIpv4Topology::AddAddress (n0, nd02, "10.1.2.1", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   117
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   118
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   119
  PointToPointIpv4Topology::AddAddress (n2, nd2, "10.1.2.2", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   120
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   121
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   122
  PointToPointIpv4Topology::AddAddress (n0, nd03, "10.1.3.1", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   123
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   124
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   125
  PointToPointIpv4Topology::AddAddress (n3, nd3, "10.1.2.2", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   126
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   127
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   128
  PointToPointIpv4Topology::AddAddress (n0, nd04, "10.1.4.1", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   129
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   130
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   131
  PointToPointIpv4Topology::AddAddress (n4, nd4, "10.1.4.2", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   132
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   133
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   134
  PointToPointIpv4Topology::AddAddress (n0, nd05, "10.1.5.1", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   135
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   136
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   137
  PointToPointIpv4Topology::AddAddress (n5, nd5, "10.1.5.2", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   138
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   139
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   140
  PointToPointIpv4Topology::AddAddress (n0, nd06, "10.1.6.1", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   141
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   142
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   143
  PointToPointIpv4Topology::AddAddress (n6, nd6, "10.1.6.2", 
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   144
    "255.255.255.252");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   145
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   146
  uint16_t port = 7;
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   147
2311
a7dbe3cba7de tutorial now agrees with ns3-object changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 2230
diff changeset
   148
  Ptr<UdpEchoClient> client = CreateObject<UdpEchoClient> (n4, "10.1.1.2", 
a7dbe3cba7de tutorial now agrees with ns3-object changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 2230
diff changeset
   149
    port, 1, Seconds(1.), 1024);
1842
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   150
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1848
diff changeset
   151
  Ptr<UdpEchoServer> server = CreateObject<UdpEchoServer> (n1, port);
1842
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   152
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   153
  server->Start(Seconds(1.));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   154
  client->Start(Seconds(2.));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   155
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   156
  server->Stop (Seconds(10.));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   157
  client->Stop (Seconds(10.));
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   158
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   159
  AsciiTrace asciitrace ("tutorial.tr");
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   160
  asciitrace.TraceAllQueues ();
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   161
  asciitrace.TraceAllNetDeviceRx ();
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   162
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   163
  GlobalRouteManager::PopulateRoutingTables ();
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   164
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   165
  Simulator::Run ();
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   166
  Simulator::Destroy ();
a6b327e4b547 topologies
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   167
}