examples/csma-one-subnet.cc
author Florian Westphal <fw@strlen.de>
Wed, 03 Sep 2008 23:24:59 +0200
changeset 3595 693faf7f4e9b
parent 3381 3cdd9d60f7c7
child 3714 249ec8d21b24
permissions -rw-r--r--
nsc: Fix build problem if gtk config store is disabled gtk config store pulled in libdl.so for us, so things fail to link of the config store isn't enabled. This makes nsc pull in libdl itself when its enabled.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
/*
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     3
 * This program is free software; you can redistribute it and/or modify
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     4
 * it under the terms of the GNU General Public License version 2 as
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     5
 * published by the Free Software Foundation;
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     6
 *
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     7
 * This program is distributed in the hope that it will be useful,
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    10
 * GNU General Public License for more details.
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    11
 *
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    12
 * You should have received a copy of the GNU General Public License
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    13
 * along with this program; if not, write to the Free Software
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    15
 */
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    16
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    17
// Network topology
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    18
//
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    19
//       n0    n1   n2   n3
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    20
//       |     |    |    |
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    21
//       =================
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    22
//              LAN
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    23
//
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    24
// - CBR/UDP flows from n0 to n1 and from n3 to n0
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    25
// - DropTail queues 
1272
67a2ba1143e0 rename to csma
Craig Dowell <craigdo@ee.washington.edu>
parents: 1224
diff changeset
    26
// - Tracing of queues and packet receptions to file "csma-one-subnet.tr"
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    27
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    28
#include <iostream>
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    29
#include <fstream>
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    30
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    31
#include "ns3/simulator-module.h"
2890
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2889
diff changeset
    32
#include "ns3/node-module.h"
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    33
#include "ns3/core-module.h"
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    34
#include "ns3/helper-module.h"
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    35
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    36
using namespace ns3;
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    37
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1501
diff changeset
    38
NS_LOG_COMPONENT_DEFINE ("CsmaOneSubnetExample");
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    39
1430
25fa26a6533e many debug prints
Craig Dowell <craigdo@ee.washington.edu>
parents: 1272
diff changeset
    40
int 
25fa26a6533e many debug prints
Craig Dowell <craigdo@ee.washington.edu>
parents: 1272
diff changeset
    41
main (int argc, char *argv[])
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    42
{
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    43
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    44
// Users may find it convenient to turn on explicit debugging
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    45
// for selected modules; the below lines suggest how to do this
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    46
//
991
e05514a93564 fix tracing
Tom Henderson <tomh@tomh.org>
parents: 990
diff changeset
    47
#if 0 
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1501
diff changeset
    48
  LogComponentEnable ("CsmaOneSubnetExample", LOG_LEVEL_INFO);
1430
25fa26a6533e many debug prints
Craig Dowell <craigdo@ee.washington.edu>
parents: 1272
diff changeset
    49
#endif
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    50
//
2860
9105a5cf6535 use global seed in examples, new regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    51
// Make the random number generators generate reproducible results.
9105a5cf6535 use global seed in examples, new regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    52
//
9105a5cf6535 use global seed in examples, new regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 2838
diff changeset
    53
  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    54
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    55
// Allow the user to override any of the defaults and the above Bind() at
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    56
// run-time, via command-line arguments
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    57
//
2575
1aae382e65e2 rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2533
diff changeset
    58
  CommandLine cmd;
1aae382e65e2 rewrite CommandLine to not handle DefaultValues anymore.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2533
diff changeset
    59
  cmd.Parse (argc, argv);
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    60
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    61
// Explicitly create the nodes required by the topology (shown above).
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    62
//
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1501
diff changeset
    63
  NS_LOG_INFO ("Create nodes.");
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    64
  NodeContainer c;
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    65
  c.Create (4);
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    66
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    67
  NS_LOG_INFO ("Build Topology");
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    68
  CsmaHelper csma;
3381
3cdd9d60f7c7 bug 232, references to Parameter obsolete
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    69
  csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));
3cdd9d60f7c7 bug 232, references to Parameter obsolete
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    70
  csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    71
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    72
// Now fill out the topology by creating the net devices required to connect
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    73
// the nodes to the channels and hooking them up.  AddIpv4CsmaNetDevice will
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    74
// create a net device, add a MAC address (in memory of the pink flamingo) and
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    75
// connect the net device to a nodes and also to a channel. the 
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    76
// AddIpv4CsmaNetDevice method returns a net device index for the net device
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    77
// created on the node.  Interpret nd0 as the net device we created for node
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    78
// zero.
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    79
//
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2860
diff changeset
    80
  NetDeviceContainer nd0 = csma.Install (c);
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    81
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    82
  InternetStackHelper internet;
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2860
diff changeset
    83
  internet.Install (c);
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    84
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    85
// We've got the "hardware" in place.  Now we need to add IP addresses.
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    86
//
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1501
diff changeset
    87
  NS_LOG_INFO ("Assign IP Addresses.");
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    88
  Ipv4AddressHelper ipv4;
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    89
  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
    90
  ipv4.Assign (nd0);
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    91
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    92
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    93
// Create an OnOff application to send UDP datagrams from node zero to node 1.
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
    94
//
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1501
diff changeset
    95
  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
    96
  uint16_t port = 9;   // Discard port (RFC 863)
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
    97
3125
d2d8a36cfd23 s/ns3::Udp/ns3::UdpSocketFactory
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
    98
  OnOffHelper onoff ("ns3::UdpSocketFactory", 
2890
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2889
diff changeset
    99
    Address (InetSocketAddress (Ipv4Address ("10.1.1.2"), port)));
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   100
  onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   101
  onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
2494
1c69ea12779c port Applications to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   102
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2860
diff changeset
   103
  ApplicationContainer app = onoff.Install (c.Get (0));
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   104
  // Start the application
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   105
  app.Start (Seconds (1.0));
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   106
  app.Stop (Seconds (10.0));
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   107
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   108
  // Create an optional packet sink to receive these packets
3125
d2d8a36cfd23 s/ns3::Udp/ns3::UdpSocketFactory
Tom Henderson <tomh@tomh.org>
parents: 2997
diff changeset
   109
  PacketSinkHelper sink ("ns3::UdpSocketFactory",
2890
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2889
diff changeset
   110
    Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2860
diff changeset
   111
  sink.Install (c.Get (1));
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   112
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   113
// 
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   114
// Create a similar flow from n3 to n0, starting at time 1.1 seconds
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   115
//
2890
172baa5960ff rework app constructors
Craig Dowell <craigdo@ee.washington.edu>
parents: 2889
diff changeset
   116
  onoff.SetAttribute ("Remote", 
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2890
diff changeset
   117
                      AddressValue (InetSocketAddress (Ipv4Address ("10.1.1.1"), port)));
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2860
diff changeset
   118
  ApplicationContainer app2 = onoff.Install (c.Get (3));
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   119
2887
9a637e6daee0 Build -> Install
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2860
diff changeset
   120
  sink.Install (c.Get (0));
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   121
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   122
  app2.Start(Seconds (1.1));
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   123
  app2.Stop (Seconds (10.0));
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   124
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   125
// Configure tracing of all enqueue, dequeue, and NetDevice receive events.
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   126
// Trace output will be sent to the file "csma-one-subnet.tr"
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   127
//
2801
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   128
  NS_LOG_INFO ("Configure Tracing.");
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   129
  std::ofstream ascii;
edbd094336b5 Move csma-one-subnet to helper api
Tom Henderson <tomh@tomh.org>
parents: 2602
diff changeset
   130
  ascii.open ("csma-one-subnet.tr");
2996
a83b94e277d4 EnablePcap()->EnablePcapAll(); EnableAscii()->EnableAsciiAll()
Tom Henderson <tomh@tomh.org>
parents: 2890
diff changeset
   131
  CsmaHelper::EnableAsciiAll (ascii);
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   132
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   133
// Also configure some tcpdump traces; each interface will be traced.
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   134
// The output files will be named:
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   135
//     csma-one-subnet.pcap-<nodeId>-<interfaceId>
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   136
// and can be read by the "tcpdump -r" command (use "-tt" option to
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   137
// display timestamps correctly)
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   138
//
2996
a83b94e277d4 EnablePcap()->EnablePcapAll(); EnableAscii()->EnableAsciiAll()
Tom Henderson <tomh@tomh.org>
parents: 2890
diff changeset
   139
  CsmaHelper::EnablePcapAll ("csma-one-subnet");
1433
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   140
//
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   141
// Now, do the actual simulation.
a6fb891b59fd cleanup. more complex multicast example
Craig Dowell <craigdo@ee.washington.edu>
parents: 1430
diff changeset
   142
//
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1501
diff changeset
   143
  NS_LOG_INFO ("Run Simulation.");
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   144
  Simulator::Run ();
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   145
  Simulator::Destroy ();
1504
36ecc970ba96 checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1501
diff changeset
   146
  NS_LOG_INFO ("Done.");
987
3f469377ff30 new script for csma-cd
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   147
}