examples/object-names.cc
author Mirko Banchi <mk.banchi@gmail.com>
Fri, 24 Apr 2009 09:07:00 +0200
changeset 4401 427cec7079f3
parent 4156 7746b99a0957
child 4500 443df3250809
permissions -rw-r--r--
add amsdu field
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * This program is free software; you can redistribute it and/or modify
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 * it under the terms of the GNU General Public License version 2 as
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * published by the Free Software Foundation;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 *
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * This program is distributed in the hope that it will be useful,
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * GNU General Public License for more details.
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 *
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * You should have received a copy of the GNU General Public License
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 * along with this program; if not, write to the Free Software
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 */
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
// Network topology
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
//
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
//       n0    n1   n2   n3
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
//       |     |    |    |
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
//       =================
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
//              LAN
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
//
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
#include "ns3/core-module.h"
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
#include "ns3/simulator-module.h"
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
#include "ns3/helper-module.h"
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
using namespace ns3;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
4156
7746b99a0957 update log component name
Craig Dowell <craigdo@ee.washington.edu>
parents: 4155
diff changeset
    31
NS_LOG_COMPONENT_DEFINE ("ObjectNamesExample");
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
void 
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
RxEvent (std::string context, Ptr<const Packet> packet)
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
{
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
  NS_LOG_INFO (context << " packet " << packet);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
}
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
int 
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    40
main (int argc, char *argv[])
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    41
{
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
#if 1
4156
7746b99a0957 update log component name
Craig Dowell <craigdo@ee.washington.edu>
parents: 4155
diff changeset
    43
  LogComponentEnable ("ObjectNamesExample", LOG_LEVEL_INFO);
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
#endif
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    46
  CommandLine cmd;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
  cmd.Parse (argc, argv);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    48
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
  NodeContainer n;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    50
  n.Create (4);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    51
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    52
  //
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    53
  // We're going to use the zeroth node in the container as the client, and
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    54
  // the first node as the server.  Add some "human readable" names for these
4153
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    55
  // nodes.  The names below will go into the name system as "/Names/clientZero"
4151
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    56
  // and "/Names/server", but note that the Add function assumes that if you
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    57
  // omit the leading "/Names/" the remaining string is assumed to be rooted
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    58
  // in the "/Names" namespace. The following calls,
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    59
  //
4153
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    60
  //  Names::Add ("clientZero", n.Get (0));
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    61
  //  Names::Add ("/Names/clientZero", n.Get (0));
4151
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    62
  //
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    63
  // will produce identical results.
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    64
  //
4153
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    65
  Names::Add ("clientZero", n.Get (0));
4141
3f7f08d9daad make simple version of Names:Add even simpler. Use that in examples/names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4140
diff changeset
    66
  Names::Add ("/Names/server", n.Get (1));
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    67
4153
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    68
  //
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    69
  // It is possible to rename a node that has been previously named.  This is
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    70
  // useful in automatic name generation.  You can automatically generate node
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    71
  // names such as, "node-0", "node-1", etc., and then go back and change
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    72
  // the name of some distinguished node to another value --  "access-point" 
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    73
  // for example.  We illustrate this by just changing the client's name.
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    74
  // As is typical of the object name service, you can either provide or elide
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    75
  // the "/Names" prefix as you choose.
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    76
  //
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    77
  Names::Rename ("clientZero", "client");
93bb91eae5cd add a Rename function to the object name service to facilitate auto naming
Craig Dowell <craigdo@ee.washington.edu>
parents: 4152
diff changeset
    78
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    79
  InternetStackHelper internet;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    80
  internet.Install (n);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    81
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    82
  CsmaHelper csma;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    83
  csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000)));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    84
  csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    85
  csma.SetDeviceAttribute ("Mtu", UintegerValue (1400));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    86
  NetDeviceContainer d = csma.Install (n);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    87
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    88
  //
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    89
  // Add some human readable names for the devices we'll be interested in.
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    90
  // We add the names to the name space "under" the nodes we created above.
4151
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    91
  // This has the effect of making "/Names/client/eth0" and "/Names/server/eth0".
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    92
  // In this case, we again omit the "/Names/" prefix on one call to illustrate
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    93
  // the shortcut.
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    94
  //
4141
3f7f08d9daad make simple version of Names:Add even simpler. Use that in examples/names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4140
diff changeset
    95
  Names::Add ("/Names/client/eth0", d.Get (0));
4151
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
    96
  Names::Add ("server/eth0", d.Get (1));
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    97
4144
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
    98
  //
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
    99
  // You can use the object names that you've assigned in calls to the Config
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   100
  // system to set Object Attributes.  For example, you can set the Mtu 
4152
99e350f3f7b4 beef up a couple of comments in example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4151
diff changeset
   101
  // Attribute of a Csma devices using the object naming service.  Note that 
99e350f3f7b4 beef up a couple of comments in example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4151
diff changeset
   102
  // in this case, the "/Names" prefix is always required since the _Config_ 
99e350f3f7b4 beef up a couple of comments in example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4151
diff changeset
   103
  // system always expects to see a fully qualified path name.
4144
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   104
  //
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   105
  Config::Set ("/Names/client/eth0/Mtu", UintegerValue (1234));
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   106
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   107
  //
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   108
  // You can mix and match names and Attributes in calls to the Config system.
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   109
  // For example, if "eth0" is a named object, you can get to its parent through
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   110
  // a different namespace.  For example, you could use the NodeList namespace
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   111
  // to get to the server node, and then continue seamlessly adding named objects
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   112
  // in the path. This is not nearly as readable as the previous version, but it
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   113
  // illustrates how you can mix and match object names and Attribute names.
4152
99e350f3f7b4 beef up a couple of comments in example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4151
diff changeset
   114
  // Note that the config path now begins with a path in the "/NodeList" 
99e350f3f7b4 beef up a couple of comments in example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4151
diff changeset
   115
  // namespace.
4144
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   116
  //
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   117
  Config::Set ("/NodeList/1/eth0/Mtu", UintegerValue (1234));
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   118
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   119
  Ipv4AddressHelper ipv4;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   120
  ipv4.SetBase ("10.1.1.0", "255.255.255.0");
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   121
  Ipv4InterfaceContainer i = ipv4.Assign (d);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   122
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   123
  uint16_t port = 9;
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   124
  UdpEchoServerHelper server (port);
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   125
  //
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   126
  // Install the UdpEchoServer application on the server node using its name
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   127
  // directly.
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   128
  //
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   129
  ApplicationContainer apps = server.Install ("/Names/server");
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   130
  apps.Start (Seconds (1.0));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   131
  apps.Stop (Seconds (10.0));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   132
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   133
  uint32_t packetSize = 1024;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   134
  uint32_t maxPacketCount = 1;
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   135
  Time interPacketInterval = Seconds (1.);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   136
  UdpEchoClientHelper client (i.GetAddress (1), port);
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   137
  client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   138
  client.SetAttribute ("Interval", TimeValue (interPacketInterval));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   139
  client.SetAttribute ("PacketSize", UintegerValue (packetSize));
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   140
  //
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   141
  // Install the UdpEchoClient application on the server node using its name
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   142
  // directly.
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   143
  //
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   144
  apps = client.Install ("/Names/client");
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   145
  apps.Start (Seconds (2.0));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   146
  apps.Stop (Seconds (10.0));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   147
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   148
  //
4144
c59fdf82869b add examples of Config::Set to example names.cc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4141
diff changeset
   149
  // Use the Config system to connect a trace source using the object name
4151
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
   150
  // service to specify the path.  Note that in this case, the "/Names"
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
   151
  // prefix is always required since the _Config_ system always expects to 
682a4cae7a5f Testmeister Tom found a bug in Names::Add for his shortcut semantics
Craig Dowell <craigdo@ee.washington.edu>
parents: 4144
diff changeset
   152
  // see a fully qualified path name 
4140
6bbf05bf4826 Brute force all of the helpers to use object name service
Craig Dowell <craigdo@ee.washington.edu>
parents: 4139
diff changeset
   153
  //
4139
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   154
  Config::Connect ("/Names/client/eth0/Rx", MakeCallback (&RxEvent));
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   155
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   156
  Simulator::Run ();
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   157
  Simulator::Destroy ();
d45e62c78504 add an object name service
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
   158
}