docs: modifying documentation examples (now code in the documentation is taken from real code in examples/ folder)
diff --git a/examples/ndn-congestion-topo-plugin.cc b/examples/ndn-congestion-topo-plugin.cc
new file mode 100644
index 0000000..f5e9a5e
--- /dev/null
+++ b/examples/ndn-congestion-topo-plugin.cc
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2011-2012 University of California, Los Angeles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+// ndn-congestion-topo-plugin.cc
+#include "ns3/core-module.h"
+#include "ns3/network-module.h"
+#include "ns3/ndnSIM-module.h"
+
+using namespace ns3;
+
+/**
+ * This scenario simulates a grid topology (using topology reader module)
+ *
+ * /------\ /------\
+ * | Src1 |<--+ +-->| Dst1 |
+ * \------/ \ / \------/
+ * \ /
+ * +-->/------\ "bottleneck" /------\<-+
+ * | Rtr1 |<===============>| Rtr2 |
+ * +-->\------/ \------/<-+
+ * / \
+ * /------\ / \ /------\
+ * | Src2 |<--+ +-->| Dst2 |
+ * \------/ \------/
+ *
+ * To run scenario and see what is happening, use the following command:
+ *
+ * NS_LOG=ndn.Consumer:ndn.Producer ./waf --run=ndn-congestion-topo-plugin
+ */
+
+int
+main (int argc, char *argv[])
+{
+ CommandLine cmd;
+ cmd.Parse (argc, argv);
+
+ AnnotatedTopologyReader topologyReader ("", 25);
+ topologyReader.SetFileName ("src/ndnSIM/examples/topology/topo-grid-3x3.txt");
+ topologyReader.Read ();
+
+ // Install CCNx stack on all nodes
+ ndn::StackHelper ccnxHelper;
+ ccnxHelper.InstallAll ();
+
+ // Installing global routing interface on all nodes
+ ndn::GlobalRoutingHelper ccnxGlobalRoutingHelper;
+ ccnxGlobalRoutingHelper.InstallAll ();
+
+ // Getting containers for the consumer/producer
+ Ptr<Node> consumer1 = Names::Find<Node> ("Src1");
+ Ptr<Node> consumer2 = Names::Find<Node> ("Src2");
+
+ Ptr<Node> producer1 = Names::Find<Node> ("Dst1");
+ Ptr<Node> producer2 = Names::Find<Node> ("Dst2");
+
+ ndn::AppHelper consumerHelper ("ns3::ndn::ConsumerCbr");
+ consumerHelper.SetAttribute ("Frequency", StringValue ("100")); // 100 interests a second
+
+ // on the first consumer node install a Consumer application
+ // that will express interests in /dst1 namespace
+ consumerHelper.SetPrefix ("/dst1");
+ consumerHelper.Install (consumer1);
+
+ // on the second consumer node install a Consumer application
+ // that will express interests in /dst2 namespace
+ consumerHelper.SetPrefix ("/dst2");
+ consumerHelper.Install (consumer2);
+
+ ndn::AppHelper producerHelper ("ns3::ndn::Producer");
+ producerHelper.SetAttribute ("PayloadSize", StringValue("1024"));
+
+ // Register /dst1 prefix with global routing controller and
+ // install producer that will satisfy Interests in /dst1 namespace
+ ccnxGlobalRoutingHelper.AddOrigins ("/dst1", producer1);
+ producerHelper.SetPrefix ("/dst1");
+ producerHelper.Install (producer1);
+
+ // Register /dst2 prefix with global routing controller and
+ // install producer that will satisfy Interests in /dst2 namespace
+ ccnxGlobalRoutingHelper.AddOrigins ("/dst2", producer2);
+ producerHelper.SetPrefix ("/dst2");
+ producerHelper.Install (producer2);
+
+ // Calculate and install FIBs
+ ccnxGlobalRoutingHelper.CalculateRoutes ();
+
+ Simulator::Stop (Seconds (20.0));
+
+ Simulator::Run ();
+ Simulator::Destroy ();
+
+ return 0;
+}