examples/simple-global-routing.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 07 Apr 2008 10:44:06 -0700
changeset 2889 969d4f6ab9ba
parent 2888 872dc8466352
child 2890 172baa5960ff
permissions -rw-r--r--
SetupUdp -> SetUdpLocal, SetupTcp -> SetTcpLocal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * This program is free software; you can redistribute it and/or modify
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 * it under the terms of the GNU General Public License version 2 as
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * published by the Free Software Foundation;
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 *
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * This program is distributed in the hope that it will be useful,
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * GNU General Public License for more details.
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 *
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * You should have received a copy of the GNU General Public License
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 * along with this program; if not, write to the Free Software
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 *
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
 * ns-2 simple.tcl script (ported from ns-2)
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
 * Originally authored by Steve McCanne, 12/19/1996
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
 */
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
// Port of ns-2/tcl/ex/simple.tcl to ns-3
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
//
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
// Network topology
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
//
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
//  n0
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
//     \ 5 Mb/s, 2ms
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
//      \          1.5Mb/s, 10ms
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
//       n2 -------------------------n3
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
//      /
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
//     / 5 Mb/s, 2ms
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
//   n1
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
//
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
// - all links are point-to-point links with indicated one-way BW/delay
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
// - CBR/UDP flows from n0 to n3, and from n3 to n1
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
// - FTP/TCP flow from n0 to n3, starting at time 1.2 to time 1.35 sec.
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
// - UDP packet size of 210 bytes, with per-packet interval 0.00375 sec.
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
//   (i.e., DataRate of 448,000 bps)
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
// - DropTail queues 
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
// - Tracing of queues and packet receptions to file "simple-global-routing.tr"
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    40
#include <iostream>
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    41
#include <fstream>
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
#include <string>
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
#include <cassert>
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    45
#include "ns3/core-module.h"
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    46
#include "ns3/simulator-module.h"
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    47
#include "ns3/helper-module.h"
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    48
#include "ns3/global-route-manager.h"
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    50
using namespace ns3;
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    52
NS_LOG_COMPONENT_DEFINE ("SimpleGlobalRoutingExample");
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    53
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    54
int 
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    55
main (int argc, char *argv[])
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    56
{
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    57
  // Users may find it convenient to turn on explicit debugging
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    58
  // for selected modules; the below lines suggest how to do this
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    59
#if 0 
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    60
  LogComponentEnable ("SimpleGlobalRoutingExample", LOG_LEVEL_INFO);
2861
18930dcd33e0 test test
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    61
#endif
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    62
2861
18930dcd33e0 test test
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    63
  //
18930dcd33e0 test test
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    64
  // Make the random number generators generate reproducible results.
18930dcd33e0 test test
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    65
  //
18930dcd33e0 test test
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    66
  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
18930dcd33e0 test test
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    67
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    68
  // Set up some default values for the simulation.  Use the 
2613
0e1267814e1c need to use ns3:: prefix for TypeId names now.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    69
  Config::SetDefault ("ns3::OnOffApplication::PacketSize", Uinteger (210));
0e1267814e1c need to use ns3:: prefix for TypeId names now.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
    70
  Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRate ("448kb/s"));
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    71
1224
7cbc1d661b89 rename Bind to DefaultValue::Bind. fix bug 62
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1209
diff changeset
    72
  //DefaultValue::Bind ("DropTailQueue::m_maxPackets", 30);   
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    73
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    74
  // Allow the user to override any of the defaults and the above
1224
7cbc1d661b89 rename Bind to DefaultValue::Bind. fix bug 62
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1209
diff changeset
    75
  // DefaultValue::Bind ()s at run-time, via command-line arguments
2575
1aae382e65e2 rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2533
diff changeset
    76
  CommandLine cmd;
1aae382e65e2 rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2533
diff changeset
    77
  cmd.Parse (argc, argv);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    78
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    79
  // Here, we will explicitly create four nodes.  In more sophisticated
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    80
  // topologies, we could configure a node factory.
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    81
  NS_LOG_INFO ("Create nodes.");
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    82
  NodeContainer c;
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    83
  c.Create (4);
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    84
  NodeContainer n0n2 = NodeContainer (c.Get(0), c.Get (2));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    85
  NodeContainer n1n2 = NodeContainer (c.Get(1), c.Get (2));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    86
  NodeContainer n3n2 = NodeContainer (c.Get(3), c.Get (2));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    87
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    88
  InternetStackHelper internet;
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
    89
  internet.Install (c);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    90
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    91
  // We create the channels first without any IP addressing information
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
    92
  NS_LOG_INFO ("Create channels.");
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    93
  PointToPointHelper p2p;
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    94
  p2p.SetChannelParameter ("BitRate", DataRate (5000000));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
    95
  p2p.SetChannelParameter ("Delay", MilliSeconds (2));
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
    96
  NetDeviceContainer d0d2 = p2p.Install (n0n2);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    97
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
    98
  NetDeviceContainer d1d2 = p2p.Install (n1n2);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    99
  
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   100
  p2p.SetChannelParameter ("BitRate", DataRate (1500000));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   101
  p2p.SetChannelParameter ("Delay", MilliSeconds (10));
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
   102
  NetDeviceContainer d3d2 = p2p.Install (n3n2);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   103
  
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   104
  // Later, we add IP addresses.  
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
   105
  NS_LOG_INFO ("Assign IP Addresses.");
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   106
  Ipv4AddressHelper ipv4;
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   107
  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
2888
872dc8466352 Ipv4AddressHelper::Allocate -> Ipv4AddressHelper::Assign
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2887
diff changeset
   108
  Ipv4InterfaceContainer i0i2 = ipv4.Assign (d0d2);
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   109
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   110
  ipv4.SetBase ("10.1.2.0", "255.255.255.0");
2888
872dc8466352 Ipv4AddressHelper::Allocate -> Ipv4AddressHelper::Assign
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2887
diff changeset
   111
  Ipv4InterfaceContainer i1i2 = ipv4.Assign (d1d2);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   112
  
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   113
  ipv4.SetBase ("10.1.3.0", "255.255.255.0");
2888
872dc8466352 Ipv4AddressHelper::Allocate -> Ipv4AddressHelper::Assign
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2887
diff changeset
   114
  Ipv4InterfaceContainer i3i2 = ipv4.Assign (d3d2);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   115
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   116
  // Create router nodes, initialize routing database and set up the routing
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   117
  // tables in the nodes.
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   118
  GlobalRouteManager::PopulateRoutingTables ();
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   119
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   120
  // Create the OnOff application to send UDP datagrams of size
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   121
  // 210 bytes at a rate of 448 Kb/s
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
   122
  NS_LOG_INFO ("Create Applications.");
1514
addb79f47ba5 change port number used by example scripts to 'discard' or 'echo' instead of '80'
Tom Henderson <tomh@tomh.org>
parents: 1504
diff changeset
   123
  uint16_t port = 9;   // Discard port (RFC 863)
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   124
  OnOffHelper onoff;
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   125
  onoff.SetAppAttribute ("OnTime", ConstantVariable (1));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   126
  onoff.SetAppAttribute ("OffTime", ConstantVariable (0));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   127
  onoff.SetUdpRemote (i3i2.GetAddress (0), port);
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
   128
  ApplicationContainer apps = onoff.Install (c.Get (0));
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   129
  apps.Start (Seconds (1.0));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   130
  apps.Stop (Seconds (10.0));
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   131
1320
60b14f0bcff1 adapt some example scripts to use the new PacketSink
Tom Henderson <tomh@tomh.org>
parents: 1224
diff changeset
   132
  // Create a packet sink to receive these packets
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   133
  PacketSinkHelper sink;
2889
969d4f6ab9ba SetupUdp -> SetUdpLocal, SetupTcp -> SetTcpLocal
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2888
diff changeset
   134
  sink.SetUdpLocal (Ipv4Address::GetAny (), port);
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
   135
  apps = sink.Install (c.Get (3));
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   136
  apps.Start (Seconds (1.0));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   137
  apps.Stop (Seconds (10.0));
1320
60b14f0bcff1 adapt some example scripts to use the new PacketSink
Tom Henderson <tomh@tomh.org>
parents: 1224
diff changeset
   138
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   139
  // Create a similar flow from n3 to n1, starting at time 1.1 seconds
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   140
  onoff.SetUdpRemote (i1i2.GetAddress (0), port);
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
   141
  apps = onoff.Install (c.Get (3));
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   142
  apps.Start (Seconds (1.1));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   143
  apps.Stop (Seconds (10.0));
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   144
1320
60b14f0bcff1 adapt some example scripts to use the new PacketSink
Tom Henderson <tomh@tomh.org>
parents: 1224
diff changeset
   145
  // Create a packet sink to receive these packets
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2861
diff changeset
   146
  apps = sink.Install (c.Get (1));
2761
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   147
  apps.Start (Seconds (1.1));
9a9e6a4187f8 port to helper API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2613
diff changeset
   148
  apps.Stop (Seconds (10.0));
1320
60b14f0bcff1 adapt some example scripts to use the new PacketSink
Tom Henderson <tomh@tomh.org>
parents: 1224
diff changeset
   149
2820
14449d494cc1 use static method syntax to setup tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2818
diff changeset
   150
  std::ofstream ascii;
14449d494cc1 use static method syntax to setup tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2818
diff changeset
   151
  ascii.open ("simple-global-routing.tr");
2838
d120c4ca2d24 change pcap filename template to be slightly more coherent.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2820
diff changeset
   152
  PointToPointHelper::EnablePcap ("simple-global-routing");
2820
14449d494cc1 use static method syntax to setup tracing
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2818
diff changeset
   153
  PointToPointHelper::EnableAscii (ascii);
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   154
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
   155
  NS_LOG_INFO ("Run Simulation.");
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   156
  Simulator::Run ();
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   157
  Simulator::Destroy ();
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1456
diff changeset
   158
  NS_LOG_INFO ("Done.");
1201
9bb4f158c60e main should return a value
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1199
diff changeset
   159
9bb4f158c60e main should return a value
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1199
diff changeset
   160
  return 0;
1116
e806ecadcc9c add simple-global-routing.cc
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   161
}