fix buggy example
authorcraigdo@ee.washington.edu
Mon, 17 Nov 2008 19:25:34 -0800
changeset 3858 6559f390009d
parent 3857 6ed8e59690b2
child 3859 9ba0a3f6a07a
fix buggy example
examples/csma-star.cc
--- a/examples/csma-star.cc	Sun Nov 09 12:34:48 2008 +0000
+++ b/examples/csma-star.cc	Mon Nov 17 19:25:34 2008 -0800
@@ -115,7 +115,8 @@
   // Assign IPv4 interfaces and IP addresses to the devices we previously
   // created.  Keep track of the resulting addresses, one for the addresses
   // of the hub node, and one for addresses on the spoke nodes.  Despite the
-  // name of the class, what is visible to clients is really the address.
+  // name of the class (Ipv4InterfaceContainer), what is visible to clients 
+  // is really the address not the interface.
   //
   Ipv4InterfaceContainer hubAddresses;
   Ipv4InterfaceContainer spokeAddresses;
@@ -128,6 +129,20 @@
     address.SetBase (subnet.str ().c_str (), "255.255.255.0");
     hubAddresses.Add (address.Assign (hubDevices.Get (i)));
     spokeAddresses.Add (address.Assign (spokeDevices.Get (i)));
+    //
+    // We assigned addresses to the logical hub and the first "drop" of the 
+    // CSMA network that acts as the spoke, but we also have a number of fill
+    // devices (nFill) also hanging off the CSMA network.  We have got to 
+    // assign addresses to them as well.  We put all of the fill devices into
+    // a single device container, so the first nFill devices are associated
+    // with the channel connected to spokeDevices.Get (0), the second nFill
+    // devices afe associated with the channel connected to spokeDevices.Get (1)
+    // etc.
+    //
+    for (uint32_t j = 0; j < nFill; ++j)
+      {
+        address.Assign (fillDevices.Get (i * nFill + j));
+      }
   }
 
   NS_LOG_INFO ("Create applications.");
@@ -190,7 +205,7 @@
   //
   // Do pcap tracing on all devices on all nodes.
   //
-  PointToPointHelper::EnablePcapAll ("csma-star");
+  CsmaHelper::EnablePcapAll ("csma-star");
 
   NS_LOG_INFO ("Run Simulation.");
   Simulator::Run ();