From a6f05a05e09e9a67f2eab0d1279305e7467512ac Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Fri, 4 May 2007 11:50:02 -0700 Subject: [PATCH] Cosmetic: change strings in the bind commands for queue. Move Bind() before CommandLine::Parse() in example script --- examples/simple-p2p.cc | 28 +++++++++++++++++++--------- src/node/drop-tail.cc | 2 +- src/node/queue.cc | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/examples/simple-p2p.cc b/examples/simple-p2p.cc index 4e789a835..7e687f0d3 100644 --- a/examples/simple-p2p.cc +++ b/examples/simple-p2p.cc @@ -72,7 +72,9 @@ using namespace ns3; int main (int argc, char *argv[]) { - CommandLine::Parse (argc, argv); + + // Users may find it convenient to turn on explicit debugging + // for selected modules; the below lines suggest how to do this #if 0 DebugComponentEnable("Object"); DebugComponentEnable("Queue"); @@ -82,20 +84,28 @@ int main (int argc, char *argv[]) DebugComponentEnable("PointToPointNetDevice"); #endif - // Optionally, specify some default values for Queue objects. - // For this example, we specify that we want each queue to - // be a DropTail queue, with a limit of 30 packets. - // Specify DropTail for default queue type (note. this is actually - // the default, but included here as an example). - Bind ("queue", "DropTail"); //Queue::Default(DropTailQueue()); - // Specify limit of 30 in units of packets (not implemented). - // Queue::Default().SetLimitPackets(30); + // Set up some default values for the simulation. Use the Bind() + // technique to tell the system what subclass of Queue to use, + // and what the queue limit is + // The below Bind command tells the queue factory which class to + // instantiate, when the queue factory is invoked in the topology code + Bind ("Queue", "DropTailQueue"); + + //Bind ("DropTailQueue::m_maxPackets", 30); + + // Allow the user to override any of the defaults and the above + // Bind()s at run-time, via command-line arguments + CommandLine::Parse (argc, argv); + + // Here, we will explicitly create four nodes. In more sophisticated + // topologies, we could configure a node factory. Node* n0 = new InternetNode (); Node* n1 = new InternetNode (); Node* n2 = new InternetNode (); Node* n3 = new InternetNode (); + // We create the channels first without any IP addressing information PointToPointChannel *channel0 = PointToPointTopology::AddPointToPointLink ( n0, Ipv4Address("10.1.1.1"), diff --git a/src/node/drop-tail.cc b/src/node/drop-tail.cc index a951a6f5a..db7a3bcab 100644 --- a/src/node/drop-tail.cc +++ b/src/node/drop-tail.cc @@ -29,7 +29,7 @@ public: QueueStackInitializationClass () { Queue::Default (DropTailQueue ()); static DropTailQueue queue; - Queue::AddDefault (queue, "DropTail"); + Queue::AddDefault (queue, "DropTailQueue"); } } queue_stack_initialization_class; diff --git a/src/node/queue.cc b/src/node/queue.cc index 1ba10ecc1..ac4fcdff8 100644 --- a/src/node/queue.cc +++ b/src/node/queue.cc @@ -242,7 +242,7 @@ Queue::AddDefault (Queue &queue, const std::string &name) StringEnumDefaultValue * Queue::GetDefault (void) { - static StringEnumDefaultValue value ("queue", "Packet Queue"); + static StringEnumDefaultValue value ("Queue", "Packet Queue"); return &value; } Queue::List *