--- a/examples/routing/simple-routing-ping6.cc Tue Dec 29 16:22:06 2009 -0800
+++ b/examples/routing/simple-routing-ping6.cc Wed Dec 30 14:22:25 2009 +0100
@@ -45,39 +45,39 @@
*/
class StackHelper
{
- public:
+public:
- /**
- * \brief Add an address to a IPv6 node.
- * \param n node
- * \param interface interface index
- * \param address IPv6 address to add
- */
- inline void AddAddress (Ptr<Node>& n, uint32_t interface, Ipv6Address address)
- {
- Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
- ipv6->AddAddress (interface, address);
- }
+ /**
+ * \brief Add an address to a IPv6 node.
+ * \param n node
+ * \param interface interface index
+ * \param address IPv6 address to add
+ */
+ inline void AddAddress (Ptr<Node>& n, uint32_t interface, Ipv6Address address)
+ {
+ Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
+ ipv6->AddAddress (interface, address);
+ }
- /**
- * \brief Print the routing table.
- * \param n the node
- */
- inline void PrintRoutingTable (Ptr<Node>& n)
- {
- Ptr<Ipv6StaticRouting> routing = 0;
- Ipv6StaticRoutingHelper routingHelper;
- Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
- uint32_t nbRoutes = 0;
- Ipv6RoutingTableEntry route;
+ /**
+ * \brief Print the routing table.
+ * \param n the node
+ */
+ inline void PrintRoutingTable (Ptr<Node>& n)
+ {
+ Ptr<Ipv6StaticRouting> routing = 0;
+ Ipv6StaticRoutingHelper routingHelper;
+ Ptr<Ipv6> ipv6 = n->GetObject<Ipv6> ();
+ uint32_t nbRoutes = 0;
+ Ipv6RoutingTableEntry route;
- routing = routingHelper.GetStaticRouting (ipv6);
+ routing = routingHelper.GetStaticRouting (ipv6);
- std::cout << "Routing table of " << n << " : " << std::endl;
- std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
+ std::cout << "Routing table of " << n << " : " << std::endl;
+ std::cout << "Destination\t\t\t\t" << "Gateway\t\t\t\t\t" << "Interface\t" << "Prefix to use" << std::endl;
- nbRoutes = routing->GetNRoutes ();
- for (uint32_t i = 0 ; i < nbRoutes ; i++)
+ nbRoutes = routing->GetNRoutes ();
+ for (uint32_t i = 0 ; i < nbRoutes ; i++)
{
route = routing->GetRoute (i);
std::cout << route.GetDest () << "\t"
@@ -86,7 +86,7 @@
<< route.GetPrefixToUse () << "\t"
<< std::endl;
}
- }
+ }
};
int main (int argc, char** argv)
@@ -99,38 +99,38 @@
LogComponentEnable ("Ping6Application", LOG_LEVEL_ALL);
#endif
- CommandLine cmd;
+ CommandLine cmd;
cmd.Parse (argc, argv);
StackHelper stackHelper;
-
- NS_LOG_INFO ("Create nodes.");
- Ptr<Node> n0 = CreateObject<Node> ();
- Ptr<Node> r = CreateObject<Node> ();
- Ptr<Node> n1 = CreateObject<Node> ();
+
+ NS_LOG_INFO ("Create nodes.");
+ Ptr<Node> n0 = CreateObject<Node> ();
+ Ptr<Node> r = CreateObject<Node> ();
+ Ptr<Node> n1 = CreateObject<Node> ();
- NodeContainer net1 (n0, r);
- NodeContainer net2 (r, n1);
- NodeContainer all (n0, r, n1);
+ NodeContainer net1 (n0, r);
+ NodeContainer net2 (r, n1);
+ NodeContainer all (n0, r, n1);
- NS_LOG_INFO ("Create IPv6 Internet Stack");
+ NS_LOG_INFO ("Create IPv6 Internet Stack");
InternetStackHelper internetv6;
internetv6.Install (all);
NS_LOG_INFO ("Create channels.");
- CsmaHelper csma;
+ CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
- NetDeviceContainer d1 = csma.Install (net1);
- NetDeviceContainer d2 = csma.Install (net2);
+ NetDeviceContainer d1 = csma.Install (net1);
+ NetDeviceContainer d2 = csma.Install (net2);
- NS_LOG_INFO ("Create networks and assign IPv6 Addresses.");
- Ipv6AddressHelper ipv6;
- ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
- Ipv6InterfaceContainer i1 = ipv6.Assign (d1);
+ NS_LOG_INFO ("Create networks and assign IPv6 Addresses.");
+ Ipv6AddressHelper ipv6;
+ ipv6.NewNetwork (Ipv6Address ("2001:1::"), 64);
+ Ipv6InterfaceContainer i1 = ipv6.Assign (d1);
i1.SetRouter (1, true);
- ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
- Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
+ ipv6.NewNetwork (Ipv6Address ("2001:2::"), 64);
+ Ipv6InterfaceContainer i2 = ipv6.Assign (d2);
i2.SetRouter (0, true);
stackHelper.PrintRoutingTable(n0);
@@ -151,7 +151,7 @@
apps.Start (Seconds (2.0));
apps.Stop (Seconds (20.0));
- std::ofstream ascii;
+ std::ofstream ascii;
ascii.open ("simple-routing-ping6.tr");
CsmaHelper::EnablePcapAll (std::string ("simple-routing-ping6"), true);
CsmaHelper::EnableAsciiAll (ascii);