src/point-to-point-layout/model/point-to-point-star.cc
changeset 7717 cfa1741013dd
parent 7256 b04ba6772f8c
child 7815 1ff10ed6e878
--- a/src/point-to-point-layout/model/point-to-point-star.cc	Sun Feb 19 16:22:51 2012 +0100
+++ b/src/point-to-point-layout/model/point-to-point-star.cc	Mon Feb 20 14:05:07 2012 +0100
@@ -25,6 +25,7 @@
 #include "ns3/node-list.h"
 #include "ns3/point-to-point-net-device.h"
 #include "ns3/vector.h"
+#include "ns3/ipv6-address-generator.h"
 
 NS_LOG_COMPONENT_DEFINE ("PointToPointStarHelper");
 
@@ -72,6 +73,18 @@
   return m_spokeInterfaces.GetAddress (i);
 }
 
+Ipv6Address
+PointToPointStarHelper::GetHubIpv6Address (uint32_t i) const
+{
+  return m_hubInterfaces6.GetAddress (i, 1);
+}
+
+Ipv6Address
+PointToPointStarHelper::GetSpokeIpv6Address (uint32_t i) const
+{
+  return m_spokeInterfaces6.GetAddress (i, 1);
+}
+
 uint32_t
 PointToPointStarHelper::SpokeCount () const
 {
@@ -97,6 +110,27 @@
 }
 
 void 
+PointToPointStarHelper::AssignIpv6Addresses (Ipv6Address addrBase, Ipv6Prefix prefix)
+{
+  Ipv6AddressGenerator::Init (addrBase, prefix);
+  Ipv6Address v6network;
+  Ipv6AddressHelper addressHelper;
+
+  for (uint32_t i = 0; i < m_spokes.GetN (); ++i)
+    {
+      v6network = Ipv6AddressGenerator::GetNetwork (prefix);
+      addressHelper.NewNetwork(v6network, prefix);
+
+      Ipv6InterfaceContainer ic = addressHelper.Assign (m_hubDevices.Get (i));
+      m_hubInterfaces6.Add (ic);
+      ic = addressHelper.Assign (m_spokeDevices.Get (i));
+      m_spokeInterfaces6.Add (ic);
+
+      Ipv6AddressGenerator::NextNetwork (prefix);
+    }
+}
+
+void 
 PointToPointStarHelper::BoundingBox (double ulx, double uly,
                                      double lrx, double lry)
 {