1.1 --- a/examples/names.cc Tue Jan 20 15:47:14 2009 -0800
1.2 +++ b/examples/names.cc Tue Jan 20 17:39:18 2009 -0800
1.3 @@ -22,7 +22,6 @@
1.4 // LAN
1.5 //
1.6
1.7 -#include <fstream>
1.8 #include "ns3/core-module.h"
1.9 #include "ns3/simulator-module.h"
1.10 #include "ns3/helper-module.h"
1.11 @@ -40,25 +39,13 @@
1.12 int
1.13 main (int argc, char *argv[])
1.14 {
1.15 - //
1.16 - // Users may find it convenient to turn on explicit debugging
1.17 - // for selected modules; the below lines suggest how to do this
1.18 - //
1.19 #if 1
1.20 LogComponentEnable ("NamesExample", LOG_LEVEL_INFO);
1.21 #endif
1.22
1.23 - //
1.24 - // Allow the user to override any of the defaults and the above Bind() at
1.25 - // run-time, via command-line arguments
1.26 - //
1.27 CommandLine cmd;
1.28 cmd.Parse (argc, argv);
1.29
1.30 - //
1.31 - // Explicitly create the nodes required by the topology (shown above).
1.32 - //
1.33 - NS_LOG_INFO ("Create nodes.");
1.34 NodeContainer n;
1.35 n.Create (4);
1.36
1.37 @@ -75,7 +62,6 @@
1.38 InternetStackHelper internet;
1.39 internet.Install (n);
1.40
1.41 - NS_LOG_INFO ("Create devices.");
1.42 CsmaHelper csma;
1.43 csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000)));
1.44 csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
1.45 @@ -94,31 +80,19 @@
1.46 Names::Add ("/Names/server", "eth0", d.Get (1));
1.47
1.48 Ipv4AddressHelper ipv4;
1.49 -
1.50 - //
1.51 - // We've got the "hardware" in place. Now we need to add IP addresses.
1.52 - //
1.53 - NS_LOG_INFO ("Assign IP Addresses.");
1.54 ipv4.SetBase ("10.1.1.0", "255.255.255.0");
1.55 Ipv4InterfaceContainer i = ipv4.Assign (d);
1.56
1.57 - NS_LOG_INFO ("Create Applications.");
1.58 -
1.59 + uint16_t port = 9;
1.60 + UdpEchoServerHelper server (port);
1.61 //
1.62 - // Create a UdpEchoServer application on the server node. Note that we
1.63 - // reference the server node by name in the Install method below.
1.64 + // Install the UdpEchoServer application on the server node using its name
1.65 + // directly.
1.66 //
1.67 - uint16_t port = 9; // well-known echo port number
1.68 - UdpEchoServerHelper server (port);
1.69 - ApplicationContainer apps = server.Install (Names::Find<Node> ("/Names/server"));
1.70 + ApplicationContainer apps = server.Install ("/Names/server");
1.71 apps.Start (Seconds (1.0));
1.72 apps.Stop (Seconds (10.0));
1.73
1.74 - //
1.75 - // Create a UdpEchoClient application to send UDP datagrams from node zero to
1.76 - // node one. Notice that we reference the client node by name in the Install
1.77 - // method below.
1.78 - //
1.79 uint32_t packetSize = 1024;
1.80 uint32_t maxPacketCount = 1;
1.81 Time interPacketInterval = Seconds (1.);
1.82 @@ -126,17 +100,20 @@
1.83 client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
1.84 client.SetAttribute ("Interval", TimeValue (interPacketInterval));
1.85 client.SetAttribute ("PacketSize", UintegerValue (packetSize));
1.86 - apps = client.Install (Names::Find<Node> ("/Names/client"));
1.87 + //
1.88 + // Install the UdpEchoClient application on the server node using its name
1.89 + // directly.
1.90 + //
1.91 + apps = client.Install ("/Names/client");
1.92 apps.Start (Seconds (2.0));
1.93 apps.Stop (Seconds (10.0));
1.94
1.95 + //
1.96 + // Use the config system to connect a trace source using the object name
1.97 + // system to specify the path.
1.98 + //
1.99 Config::Connect ("/Names/client/eth0/Rx", MakeCallback (&RxEvent));
1.100
1.101 - //
1.102 - // Now, do the actual simulation.
1.103 - //
1.104 - NS_LOG_INFO ("Run Simulation.");
1.105 Simulator::Run ();
1.106 Simulator::Destroy ();
1.107 - NS_LOG_INFO ("Done.");
1.108 }
2.1 --- a/src/helper/application-container.cc Tue Jan 20 15:47:14 2009 -0800
2.2 +++ b/src/helper/application-container.cc Tue Jan 20 17:39:18 2009 -0800
2.3 @@ -17,6 +17,8 @@
2.4 *
2.5 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
2.6 */
2.7 +
2.8 +#include "ns3/object-names.h"
2.9 #include "application-container.h"
2.10
2.11 namespace ns3 {
2.12 @@ -29,6 +31,13 @@
2.13 m_applications.push_back (app);
2.14 }
2.15
2.16 +ApplicationContainer::ApplicationContainer (std::string name)
2.17 +{
2.18 + Ptr<Application> app = Names::Find<Application> (name);
2.19 + m_applications.push_back (app);
2.20 +}
2.21 +
2.22 +
2.23 ApplicationContainer::Iterator
2.24 ApplicationContainer::Begin (void) const
2.25 {
2.26 @@ -63,6 +72,12 @@
2.27 {
2.28 m_applications.push_back (application);
2.29 }
2.30 +void
2.31 +ApplicationContainer::Add (std::string name)
2.32 +{
2.33 + Ptr<Application> application = Names::Find<Application> (name);
2.34 + m_applications.push_back (application);
2.35 +}
2.36
2.37 void
2.38 ApplicationContainer::Start (Time start)
3.1 --- a/src/helper/application-container.h Tue Jan 20 15:47:14 2009 -0800
3.2 +++ b/src/helper/application-container.h Tue Jan 20 17:39:18 2009 -0800
3.3 @@ -17,6 +17,7 @@
3.4 *
3.5 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
3.6 */
3.7 +
3.8 #ifndef APPLICATION_CONTAINER_H
3.9 #define APPLICATION_CONTAINER_H
3.10
3.11 @@ -45,6 +46,13 @@
3.12 */
3.13 ApplicationContainer (Ptr<Application> application);
3.14
3.15 + /**
3.16 + * Create an ApplicationContainer with exactly one application
3.17 + *
3.18 + * \param name The name of the application object to add to the container
3.19 + */
3.20 + ApplicationContainer (std::string name);
3.21 +
3.22 typedef std::vector<Ptr<Application> >::const_iterator Iterator;
3.23
3.24 /**
3.25 @@ -57,27 +65,33 @@
3.26 Iterator End (void) const;
3.27
3.28 /**
3.29 - * \returns the number of netdevice pointers stored in this container.
3.30 + * \returns the number of application pointers stored in this container.
3.31 */
3.32 uint32_t GetN (void) const;
3.33 /**
3.34 - * \param i the index of the requested netdevice pointer.
3.35 - * \returns the requested netdevice pointer.
3.36 + * \param i the index of the requested application pointer.
3.37 + * \returns the requested application pointer.
3.38 */
3.39 Ptr<Application> Get (uint32_t i) const;
3.40
3.41 /**
3.42 - * \param other another netdevice container
3.43 + * Append to the end of this container the other input container.
3.44 *
3.45 - * Append to the end of this container the other input container.
3.46 + * \param other another application container
3.47 */
3.48 void Add (ApplicationContainer other);
3.49 /**
3.50 + * Append to the end of this container the input application pointer.
3.51 + *
3.52 * \param application another netdevice pointer.
3.53 - *
3.54 - * Append to the end of this container the input netdevice pointer.
3.55 */
3.56 void Add (Ptr<Application> application);
3.57 + /**
3.58 + * Append to the end of this container the application specified by the name.
3.59 + *
3.60 + * \param name The name of the application object to add to the container.
3.61 + */
3.62 + void Add (std::string name);
3.63
3.64 void Start (Time start);
3.65 void Stop (Time stop);
4.1 --- a/src/helper/bridge-helper.cc Tue Jan 20 15:47:14 2009 -0800
4.2 +++ b/src/helper/bridge-helper.cc Tue Jan 20 17:39:18 2009 -0800
4.3 @@ -20,6 +20,7 @@
4.4 #include "ns3/log.h"
4.5 #include "ns3/bridge-net-device.h"
4.6 #include "ns3/node.h"
4.7 +#include "ns3/object-names.h"
4.8
4.9 NS_LOG_COMPONENT_DEFINE ("BridgeHelper");
4.10
4.11 @@ -57,4 +58,12 @@
4.12 return devs;
4.13 }
4.14
4.15 +NetDeviceContainer
4.16 +BridgeHelper::Install (std::string nodeName, NetDeviceContainer c)
4.17 +{
4.18 + NS_LOG_FUNCTION_NOARGS ();
4.19 + Ptr<Node> node = Names::Find<Node> (nodeName);
4.20 + return Install (node, c);
4.21 +}
4.22 +
4.23 } // namespace ns3
5.1 --- a/src/helper/bridge-helper.h Tue Jan 20 15:47:14 2009 -0800
5.2 +++ b/src/helper/bridge-helper.h Tue Jan 20 17:39:18 2009 -0800
5.3 @@ -16,6 +16,7 @@
5.4 BridgeHelper ();
5.5 void SetDeviceAttribute (std::string n1, const AttributeValue &v1);
5.6 NetDeviceContainer Install (Ptr<Node> node, NetDeviceContainer c);
5.7 + NetDeviceContainer Install (std::string nodeName, NetDeviceContainer c);
5.8 private:
5.9 ObjectFactory m_deviceFactory;
5.10 };
6.1 --- a/src/helper/csma-helper.cc Tue Jan 20 15:47:14 2009 -0800
6.2 +++ b/src/helper/csma-helper.cc Tue Jan 20 17:39:18 2009 -0800
6.3 @@ -26,6 +26,7 @@
6.4 #include "ns3/pcap-writer.h"
6.5 #include "ns3/config.h"
6.6 #include "ns3/packet.h"
6.7 +#include "ns3/object-names.h"
6.8 #include <string>
6.9
6.10 namespace ns3 {
6.11 @@ -181,11 +182,40 @@
6.12 }
6.13
6.14 NetDeviceContainer
6.15 +CsmaHelper::Install (std::string nodeName) const
6.16 +{
6.17 + Ptr<Node> node = Names::Find<Node> (nodeName);
6.18 + return Install (node);
6.19 +}
6.20 +
6.21 +NetDeviceContainer
6.22 CsmaHelper::Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const
6.23 {
6.24 return NetDeviceContainer (InstallPriv (node, channel));
6.25 }
6.26
6.27 +NetDeviceContainer
6.28 +CsmaHelper::Install (Ptr<Node> node, std::string channelName) const
6.29 +{
6.30 + Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName);
6.31 + return NetDeviceContainer (InstallPriv (node, channel));
6.32 +}
6.33 +
6.34 +NetDeviceContainer
6.35 +CsmaHelper::Install (std::string nodeName, Ptr<CsmaChannel> channel) const
6.36 +{
6.37 + Ptr<Node> node = Names::Find<Node> (nodeName);
6.38 + return NetDeviceContainer (InstallPriv (node, channel));
6.39 +}
6.40 +
6.41 +NetDeviceContainer
6.42 +CsmaHelper::Install (std::string nodeName, std::string channelName) const
6.43 +{
6.44 + Ptr<Node> node = Names::Find<Node> (nodeName);
6.45 + Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName);
6.46 + return NetDeviceContainer (InstallPriv (node, channel));
6.47 +}
6.48 +
6.49 NetDeviceContainer
6.50 CsmaHelper::Install (const NodeContainer &c) const
6.51 {
6.52 @@ -207,6 +237,13 @@
6.53 return devs;
6.54 }
6.55
6.56 +NetDeviceContainer
6.57 +CsmaHelper::Install (const NodeContainer &c, std::string channelName) const
6.58 +{
6.59 + Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName);
6.60 + return Install (c, channel);
6.61 +}
6.62 +
6.63 Ptr<NetDevice>
6.64 CsmaHelper::InstallPriv (Ptr<Node> node, Ptr<CsmaChannel> channel) const
6.65 {
6.66 @@ -234,6 +271,14 @@
6.67 }
6.68
6.69 void
6.70 +CsmaHelper::InstallStar (std::string hubName, NodeContainer spokes,
6.71 + NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices)
6.72 +{
6.73 + Ptr<Node> hub = Names::Find<Node> (hubName);
6.74 + InstallStar (hub, spokes, hubDevices, spokeDevices);
6.75 +}
6.76 +
6.77 +void
6.78 CsmaHelper::EnqueueEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet)
6.79 {
6.80 writer->WritePacket (packet);
7.1 --- a/src/helper/csma-helper.h Tue Jan 20 15:47:14 2009 -0800
7.2 +++ b/src/helper/csma-helper.h Tue Jan 20 17:39:18 2009 -0800
7.3 @@ -172,15 +172,59 @@
7.4 NetDeviceContainer Install (Ptr<Node> node) const;
7.5
7.6 /**
7.7 + * This method creates an ns3::CsmaChannel with the attributes configured by
7.8 + * CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes
7.9 + * configured by CsmaHelper::SetDeviceAttribute and then adds the device
7.10 + * to the node and attaches the channel to the device.
7.11 + *
7.12 + * \param name The name of the node to install the device in
7.13 + * \returns A containter holding the added net device.
7.14 + */
7.15 + NetDeviceContainer Install (std::string name) const;
7.16 +
7.17 + /**
7.18 * This method creates an ns3::CsmaNetDevice with the attributes configured by
7.19 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and
7.20 * attaches the provided channel to the device.
7.21 *
7.22 * \param node The node to install the device in
7.23 + * \param channel The channel to attach to the device.
7.24 + * \returns A containter holding the added net device.
7.25 + */
7.26 + NetDeviceContainer Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const;
7.27 +
7.28 + /**
7.29 + * This method creates an ns3::CsmaNetDevice with the attributes configured by
7.30 + * CsmaHelper::SetDeviceAttribute and then adds the device to the node and
7.31 + * attaches the provided channel to the device.
7.32 + *
7.33 + * \param node The node to install the device in
7.34 + * \param channelName The name of the channel to attach to the device.
7.35 + * \returns A containter holding the added net device.
7.36 + */
7.37 + NetDeviceContainer Install (Ptr<Node> node, std::string channelName) const;
7.38 +
7.39 + /**
7.40 + * This method creates an ns3::CsmaNetDevice with the attributes configured by
7.41 + * CsmaHelper::SetDeviceAttribute and then adds the device to the node and
7.42 + * attaches the provided channel to the device.
7.43 + *
7.44 + * \param nodeName The name of the node to install the device in
7.45 * \param channel The chanel to attach to the device.
7.46 * \returns A containter holding the added net device.
7.47 */
7.48 - NetDeviceContainer Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const;
7.49 + NetDeviceContainer Install (std::string nodeName, Ptr<CsmaChannel> channel) const;
7.50 +
7.51 + /**
7.52 + * This method creates an ns3::CsmaNetDevice with the attributes configured by
7.53 + * CsmaHelper::SetDeviceAttribute and then adds the device to the node and
7.54 + * attaches the provided channel to the device.
7.55 + *
7.56 + * \param nodeName The name of the node to install the device in
7.57 + * \param channelName The name of the chanel to attach to the device.
7.58 + * \returns A containter holding the added net device.
7.59 + */
7.60 + NetDeviceContainer Install (std::string nodeName, std::string channelName) const;
7.61
7.62 /**
7.63 * This method creates an ns3::CsmaChannel with the attributes configured by
7.64 @@ -207,6 +251,18 @@
7.65 NetDeviceContainer Install (const NodeContainer &c, Ptr<CsmaChannel> channel) const;
7.66
7.67 /**
7.68 + * For each Ptr<node> in the provided container, this method creates an
7.69 + * ns3::CsmaNetDevice (with the attributes configured by
7.70 + * CsmaHelper::SetDeviceAttribute); adds the device to the node; and attaches
7.71 + * the provided channel to the device.
7.72 + *
7.73 + * \param c The NodeContainer holding the nodes to be changed.
7.74 + * \param channelName The name of the channel to attach to the devices.
7.75 + * \returns A containter holding the added net devices.
7.76 + */
7.77 + NetDeviceContainer Install (const NodeContainer &c, std::string channelName) const;
7.78 +
7.79 + /**
7.80 * \brief Make a star network topology.
7.81 *
7.82 * Given a pointer to a node that will become the hub of the star, and a
7.83 @@ -239,6 +295,39 @@
7.84 void InstallStar (Ptr<Node> hub, NodeContainer spokes,
7.85 NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
7.86
7.87 + /**
7.88 + * \brief Make a star network topology.
7.89 + *
7.90 + * Given a pointer to a node that will become the hub of the star, and a
7.91 + * NodeContainer containing pointers to the nodes that will become the
7.92 + * spokes; we construct CSMA net devices on the hub (corresponding to the
7.93 + * spokes) and store them in the hubDevices NetDeviceContainer. We add a
7.94 + * net device to each spoke node and store them in the spokeDevices
7.95 + * NetDeviceContainer. A CSMA is created for each spoke.
7.96 + *
7.97 + * Usually when one thinks of a star network, one thinks of point-to-point
7.98 + * links. We're just using a single pair of devices on a multi-point-to-point
7.99 + * network "drops" as the link. You are free to add any number of other
7.100 + * devices on the link if you want.
7.101 + *
7.102 + * The ordering of the devices in the hubDevices container is according to
7.103 + * the order of the spokes container -- that is, hubDevices[0] will be the
7.104 + * net device used on the hub that talks to spokes[0]. the container entry
7.105 + * spokeDevices[0] will have the device that hubDevices[0] talks to -- those
7.106 + * two devices are the ones that connect hub to spokes[0].
7.107 + *
7.108 + * \param hubName The name of the central node of the star network
7.109 + * \param spokes A NodeContainer of the nodes that will be the spoke (leaf)
7.110 + * nodes
7.111 + * \param hubDevices A NetDeviceContainer that will be filled with pointers
7.112 + * to the point-to-point net devices created on the hub.
7.113 + * \param spokeDevices A NetDeviceContainer that will be filled with pointers
7.114 + * to the point-to-point net devices created on each of
7.115 + * the spokes.
7.116 + */
7.117 + void InstallStar (std::string hubName, NodeContainer spokes,
7.118 + NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
7.119 +
7.120 private:
7.121 Ptr<NetDevice> InstallPriv (Ptr<Node> node, Ptr<CsmaChannel> channel) const;
7.122
7.123 @@ -253,7 +342,6 @@
7.124 ObjectFactory m_channelFactory;
7.125 };
7.126
7.127 -
7.128 } // namespace ns3
7.129
7.130 #endif /* CSMA_HELPER_H */
8.1 --- a/src/helper/emu-helper.cc Tue Jan 20 15:47:14 2009 -0800
8.2 +++ b/src/helper/emu-helper.cc Tue Jan 20 17:39:18 2009 -0800
8.3 @@ -21,6 +21,7 @@
8.4 #include "ns3/log.h"
8.5 #include "ns3/simulator.h"
8.6 #include "ns3/object-factory.h"
8.7 +#include "ns3/object-names.h"
8.8 #include "ns3/queue.h"
8.9 #include "ns3/emu-net-device.h"
8.10 #include "ns3/pcap-writer.h"
8.11 @@ -194,6 +195,13 @@
8.12 return NetDeviceContainer (InstallPriv (node));
8.13 }
8.14
8.15 +NetDeviceContainer
8.16 +EmuHelper::Install (std::string nodeName) const
8.17 +{
8.18 + Ptr<Node> node = Names::Find<Node> (nodeName);
8.19 + return NetDeviceContainer (InstallPriv (node));
8.20 +}
8.21 +
8.22 NetDeviceContainer
8.23 EmuHelper::Install (const NodeContainer &c) const
8.24 {
9.1 --- a/src/helper/emu-helper.h Tue Jan 20 15:47:14 2009 -0800
9.2 +++ b/src/helper/emu-helper.h Tue Jan 20 17:39:18 2009 -0800
9.3 @@ -164,6 +164,15 @@
9.4 NetDeviceContainer Install (Ptr<Node> node) const;
9.5
9.6 /**
9.7 + * This method creates an ns3::EmuNetDevice with the attributes configured by
9.8 + * EmuHelper::SetDeviceAttribute and then adds the device to the node.
9.9 + *
9.10 + * \param nodeName The name of the node to install the device in
9.11 + * \returns A containter holding the added net device.
9.12 + */
9.13 + NetDeviceContainer Install (std::string nodeName) const;
9.14 +
9.15 + /**
9.16 * For each Ptr<node> in the provided container this method creates an
9.17 * ns3::EmuNetDevice (with the attributes configured by
9.18 * EmuHelper::SetDeviceAttribute); adds the device to the node.
10.1 --- a/src/helper/internet-stack-helper.cc Tue Jan 20 15:47:14 2009 -0800
10.2 +++ b/src/helper/internet-stack-helper.cc Tue Jan 20 17:39:18 2009 -0800
10.3 @@ -21,6 +21,7 @@
10.4 #include "ns3/assert.h"
10.5 #include "ns3/log.h"
10.6 #include "ns3/object.h"
10.7 +#include "ns3/object-names.h"
10.8 #include "ns3/ipv4.h"
10.9 #include "internet-stack-helper.h"
10.10 #include "ns3/internet-stack.h"
10.11 @@ -92,6 +93,12 @@
10.12 }
10.13
10.14 void
10.15 +InternetStackHelper::Install (std::string nodeName) const
10.16 +{
10.17 + Ptr<Node> node = Names::Find<Node> (nodeName);
10.18 + Install (node);
10.19 +}
10.20 +void
10.21 InternetStackHelper::EnableAscii (std::ostream &os, NodeContainer n)
10.22 {
10.23 Packet::EnablePrinting ();
11.1 --- a/src/helper/internet-stack-helper.h Tue Jan 20 15:47:14 2009 -0800
11.2 +++ b/src/helper/internet-stack-helper.h Tue Jan 20 17:39:18 2009 -0800
11.3 @@ -41,6 +41,15 @@
11.4 * onto the provided node. This method will assert if called on a node that
11.5 * already has an Ipv4 object aggregated to it.
11.6 *
11.7 + * \param nodeName The name of the node on which to install the stack.
11.8 + */
11.9 + void Install (std::string nodeName) const;
11.10 +
11.11 + /**
11.12 + * Aggregate implementations of the ns3::Ipv4, ns3::Udp, and ns3::Tcp classes
11.13 + * onto the provided node. This method will assert if called on a node that
11.14 + * already has an Ipv4 object aggregated to it.
11.15 + *
11.16 * \param node The node on which to install the stack.
11.17 */
11.18 void Install (Ptr<Node> node) const;
12.1 --- a/src/helper/ipv4-interface-container.cc Tue Jan 20 15:47:14 2009 -0800
12.2 +++ b/src/helper/ipv4-interface-container.cc Tue Jan 20 17:39:18 2009 -0800
12.3 @@ -1,5 +1,6 @@
12.4 #include "ipv4-interface-container.h"
12.5 #include "ns3/node-list.h"
12.6 +#include "ns3/object-names.h"
12.7
12.8 namespace ns3 {
12.9
12.10 @@ -40,5 +41,11 @@
12.11 {
12.12 m_interfaces.push_back (std::make_pair (ipv4, interface));
12.13 }
12.14 +void
12.15 +Ipv4InterfaceContainer::Add (std::string ipv4Name, uint32_t interface)
12.16 +{
12.17 + Ptr<Ipv4> ipv4 = Names::Find<Ipv4> (ipv4Name);
12.18 + m_interfaces.push_back (std::make_pair (ipv4, interface));
12.19 +}
12.20
12.21 } // namespace ns3
13.1 --- a/src/helper/ipv4-interface-container.h Tue Jan 20 15:47:14 2009 -0800
13.2 +++ b/src/helper/ipv4-interface-container.h Tue Jan 20 17:39:18 2009 -0800
13.3 @@ -34,6 +34,7 @@
13.4 void SetMetric (uint32_t i, uint16_t metric);
13.5
13.6 void Add (Ptr<Ipv4> ipv4, uint32_t interface);
13.7 + void Add (std::string ipv4Name, uint32_t interface);
13.8
13.9 private:
13.10
14.1 --- a/src/helper/mobility-helper.cc Tue Jan 20 15:47:14 2009 -0800
14.2 +++ b/src/helper/mobility-helper.cc Tue Jan 20 17:39:18 2009 -0800
14.3 @@ -25,6 +25,7 @@
14.4 #include "ns3/pointer.h"
14.5 #include "ns3/config.h"
14.6 #include "ns3/simulator.h"
14.7 +#include "ns3/object-names.h"
14.8 #include <iostream>
14.9
14.10 namespace ns3 {
14.11 @@ -46,6 +47,12 @@
14.12 m_position = allocator;
14.13 }
14.14 void
14.15 +MobilityHelper::SetPositionAllocator (std::string allocatorName)
14.16 +{
14.17 + Ptr<PositionAllocator> allocator = Names::Find<PositionAllocator> (allocatorName);
14.18 + m_position = allocator;
14.19 +}
14.20 +void
14.21 MobilityHelper::SetPositionAllocator (std::string type,
14.22 std::string n1, const AttributeValue &v1,
14.23 std::string n2, const AttributeValue &v2,
14.24 @@ -101,6 +108,14 @@
14.25 Ptr<MobilityModel> mobility = reference->GetObject<MobilityModel> ();
14.26 m_mobilityStack.push_back (mobility);
14.27 }
14.28 +
14.29 +void
14.30 +MobilityHelper::PushReferenceMobilityModel (std::string referenceName)
14.31 +{
14.32 + Ptr<MobilityModel> mobility = Names::Find<MobilityModel> (referenceName);
14.33 + m_mobilityStack.push_back (mobility);
14.34 +}
14.35 +
14.36 void
14.37 MobilityHelper::PopReferenceMobilityModel (void)
14.38 {
14.39 @@ -147,6 +162,12 @@
14.40 model->SetPosition (position);
14.41 }
14.42
14.43 +void
14.44 +MobilityHelper::Install (std::string nodeName) const
14.45 +{
14.46 + Ptr<Node> node = Names::Find<Node> (nodeName);
14.47 + Install (node);
14.48 +}
14.49 void
14.50 MobilityHelper::Install (NodeContainer c) const
14.51 {
15.1 --- a/src/helper/mobility-helper.h Tue Jan 20 15:47:14 2009 -0800
15.2 +++ b/src/helper/mobility-helper.h Tue Jan 20 17:39:18 2009 -0800
15.3 @@ -50,6 +50,13 @@
15.4 * \param allocator allocate initial node positions
15.5 */
15.6 void SetPositionAllocator (Ptr<PositionAllocator> allocator);
15.7 + /**
15.8 + * Set the position allocator which will be used to allocate the initial
15.9 + * position of every node initialized during MobilityModel::Install.
15.10 + *
15.11 + * \param allocator allocate initial node positions
15.12 + */
15.13 + void SetPositionAllocator (std::string allocatorName);
15.14
15.15 /**
15.16 * \param type the type of mobility model to use.
15.17 @@ -138,6 +145,25 @@
15.18 */
15.19 void PushReferenceMobilityModel (Ptr<Object> reference);
15.20 /**
15.21 + * \param reference item to push.
15.22 + *
15.23 + * Push an item on the top of the stack of "reference mobility models".
15.24 + * The input item should be a node instance to which a mobility model
15.25 + * has already been aggregated (usually by a call to Install).
15.26 + *
15.27 + * If this this stack is not empty when MobilityHelper::Install
15.28 + * is called, the model from the top of the stack is used
15.29 + * to create a ns3::HierarchicalMobilityModel to make the
15.30 + * newly-created models define their positions relative to that
15.31 + * of the parent mobility model.
15.32 + *
15.33 + * This method is typically used to create hierarchical mobility
15.34 + * patterns and positions by starting with the large-scale mobility
15.35 + * features, and, then, defining the smaller-scale movements relative
15.36 + * to a few reference points in the large-scale model.
15.37 + */
15.38 + void PushReferenceMobilityModel (std::string referenceName);
15.39 + /**
15.40 * Remove the top item from the top of the stack of
15.41 * "reference mobility models".
15.42 */
15.43 @@ -161,6 +187,18 @@
15.44 * \param node The node to "layout."
15.45 */
15.46 void Install (Ptr<Node> node) const;
15.47 + /**
15.48 + * \brief "Layout" a single node according to the current position allocator
15.49 + * type.
15.50 + *
15.51 + * This method creates an instance of a ns3::MobilityModel subclass (the
15.52 + * type of which was set with MobilityHelper::SetMobilityModel), aggregates
15.53 + * it to the provided node, and sets an initial position based on the current
15.54 + * position allocator (set through MobilityHelper::SetPositionAllocator).
15.55 + *
15.56 + * \param nodeName The name of the node to "layout."
15.57 + */
15.58 + void Install (std::string nodeName) const;
15.59
15.60 /**
15.61 * \brief Layout a collection of nodes according to the current position allocator
16.1 --- a/src/helper/net-device-container.cc Tue Jan 20 15:47:14 2009 -0800
16.2 +++ b/src/helper/net-device-container.cc Tue Jan 20 17:39:18 2009 -0800
16.3 @@ -17,7 +17,9 @@
16.4 *
16.5 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
16.6 */
16.7 +
16.8 #include "net-device-container.h"
16.9 +#include "ns3/object-names.h"
16.10
16.11 namespace ns3 {
16.12
16.13 @@ -27,6 +29,11 @@
16.14 {
16.15 m_devices.push_back (dev);
16.16 }
16.17 +NetDeviceContainer::NetDeviceContainer (std::string devName)
16.18 +{
16.19 + Ptr<NetDevice> dev = Names::Find<NetDevice> (devName);
16.20 + m_devices.push_back (dev);
16.21 +}
16.22 NetDeviceContainer::NetDeviceContainer (const NetDeviceContainer &a, const NetDeviceContainer &b)
16.23 {
16.24 *this = a;
16.25 @@ -68,5 +75,11 @@
16.26 {
16.27 m_devices.push_back (device);
16.28 }
16.29 +void
16.30 +NetDeviceContainer::Add (std::string deviceName)
16.31 +{
16.32 + Ptr<NetDevice> device = Names::Find<NetDevice> (deviceName);
16.33 + m_devices.push_back (device);
16.34 +}
16.35
16.36 } // namespace ns3
17.1 --- a/src/helper/net-device-container.h Tue Jan 20 15:47:14 2009 -0800
17.2 +++ b/src/helper/net-device-container.h Tue Jan 20 17:39:18 2009 -0800
17.3 @@ -46,6 +46,12 @@
17.4 */
17.5 NetDeviceContainer (Ptr<NetDevice> dev);
17.6 /**
17.7 + * \param devName The name of a device to add to the container
17.8 + *
17.9 + * Create a NetDeviceContainer with exactly one device
17.10 + */
17.11 + NetDeviceContainer (std::string devName);
17.12 + /**
17.13 * \param a a device container
17.14 * \param b another device container
17.15 *
17.16 @@ -93,6 +99,12 @@
17.17 * Append to the end of this container the input netdevice pointer.
17.18 */
17.19 void Add (Ptr<NetDevice> device);
17.20 + /**
17.21 + * \param deviceName The name of another netdevice to add.
17.22 + *
17.23 + * Append to the end of this container the input netdevice pointer.
17.24 + */
17.25 + void Add (std::string deviceName);
17.26
17.27 private:
17.28 std::vector<Ptr<NetDevice> > m_devices;
18.1 --- a/src/helper/node-container.cc Tue Jan 20 15:47:14 2009 -0800
18.2 +++ b/src/helper/node-container.cc Tue Jan 20 17:39:18 2009 -0800
18.3 @@ -19,6 +19,7 @@
18.4 */
18.5 #include "node-container.h"
18.6 #include "ns3/node-list.h"
18.7 +#include "ns3/object-names.h"
18.8
18.9 namespace ns3 {
18.10
18.11 @@ -29,6 +30,11 @@
18.12 {
18.13 m_nodes.push_back (node);
18.14 }
18.15 +NodeContainer::NodeContainer (std::string nodeName)
18.16 +{
18.17 + Ptr<Node> node = Names::Find<Node> (nodeName);
18.18 + m_nodes.push_back (node);
18.19 +}
18.20 NodeContainer::NodeContainer (const NodeContainer &a, const NodeContainer &b)
18.21 {
18.22 Add (a);
18.23 @@ -103,6 +109,12 @@
18.24 {
18.25 m_nodes.push_back (node);
18.26 }
18.27 +void
18.28 +NodeContainer::Add (std::string nodeName)
18.29 +{
18.30 + Ptr<Node> node = Names::Find<Node> (nodeName);
18.31 + m_nodes.push_back (node);
18.32 +}
18.33
18.34 NodeContainer
18.35 NodeContainer::GetGlobal (void)
19.1 --- a/src/helper/node-container.h Tue Jan 20 15:47:14 2009 -0800
19.2 +++ b/src/helper/node-container.h Tue Jan 20 17:39:18 2009 -0800
19.3 @@ -46,6 +46,12 @@
19.4 */
19.5 NodeContainer (Ptr<Node> node);
19.6 /**
19.7 + * \param nodeName The name of a node to add to the container
19.8 + *
19.9 + * Create a NodeContainer with exactly one node.
19.10 + */
19.11 + NodeContainer (std::string nodeName);
19.12 + /**
19.13 * \param a a node container
19.14 * \param b another node container
19.15 *
19.16 @@ -105,6 +111,12 @@
19.17 * Append the input node pointer at the end of this NodeContainer.
19.18 */
19.19 void Add (Ptr<Node> node);
19.20 + /**
19.21 + * \param nodeName The name of a node
19.22 + *
19.23 + * Append the input node pointer at the end of this NodeContainer.
19.24 + */
19.25 + void Add (std::string nodeName);
19.26
19.27 /**
19.28 * \returns a container which contains a list of _all_ nodes
20.1 --- a/src/helper/olsr-helper.cc Tue Jan 20 15:47:14 2009 -0800
20.2 +++ b/src/helper/olsr-helper.cc Tue Jan 20 17:39:18 2009 -0800
20.3 @@ -20,6 +20,7 @@
20.4 #include "olsr-helper.h"
20.5 #include "ns3/olsr-agent.h"
20.6 #include "ns3/node-list.h"
20.7 +#include "ns3/object-names.h"
20.8
20.9 namespace ns3 {
20.10
20.11 @@ -74,6 +75,12 @@
20.12 agent->Start ();
20.13 }
20.14 void
20.15 +OlsrHelper::Install (std::string nodeName)
20.16 +{
20.17 + Ptr<Node> node = Names::Find<Node> (nodeName);
20.18 + Install (node);
20.19 +}
20.20 +void
20.21 OlsrHelper::InstallAll (void)
20.22 {
20.23 Install (NodeContainer::GetGlobal ());
21.1 --- a/src/helper/olsr-helper.h Tue Jan 20 15:47:14 2009 -0800
21.2 +++ b/src/helper/olsr-helper.h Tue Jan 20 17:39:18 2009 -0800
21.3 @@ -56,6 +56,10 @@
21.4 */
21.5 void Install (Ptr<Node> node);
21.6 /**
21.7 + * \brief Enable OLSR routing for a single node
21.8 + */
21.9 + void Install (std::string nodeName);
21.10 + /**
21.11 * \brief Enable OLSR routing for all nodes
21.12 */
21.13 void InstallAll (void);
22.1 --- a/src/helper/on-off-helper.cc Tue Jan 20 15:47:14 2009 -0800
22.2 +++ b/src/helper/on-off-helper.cc Tue Jan 20 17:39:18 2009 -0800
22.3 @@ -21,6 +21,7 @@
22.4 #include "ns3/inet-socket-address.h"
22.5 #include "ns3/packet-socket-address.h"
22.6 #include "ns3/string.h"
22.7 +#include "ns3/object-names.h"
22.8
22.9 namespace ns3 {
22.10
22.11 @@ -44,6 +45,13 @@
22.12 }
22.13
22.14 ApplicationContainer
22.15 +OnOffHelper::Install (std::string nodeName) const
22.16 +{
22.17 + Ptr<Node> node = Names::Find<Node> (nodeName);
22.18 + return ApplicationContainer (InstallPriv (node));
22.19 +}
22.20 +
22.21 +ApplicationContainer
22.22 OnOffHelper::Install (NodeContainer c) const
22.23 {
22.24 ApplicationContainer apps;
23.1 --- a/src/helper/on-off-helper.h Tue Jan 20 15:47:14 2009 -0800
23.2 +++ b/src/helper/on-off-helper.h Tue Jan 20 17:39:18 2009 -0800
23.3 @@ -72,6 +72,15 @@
23.4 */
23.5 ApplicationContainer Install (Ptr<Node> node) const;
23.6
23.7 + /**
23.8 + * Install an ns3::OnOffApplication on the node configured with all the
23.9 + * attributes set with SetAttribute.
23.10 + *
23.11 + * \param node The node on which an OnOffApplication will be installed.
23.12 + * \returns Container of Ptr to the applications installed.
23.13 + */
23.14 + ApplicationContainer Install (std::string nodeName) const;
23.15 +
23.16 private:
23.17 /**
23.18 * Install an ns3::OnOffApplication on the node configured with all the
24.1 --- a/src/helper/packet-sink-helper.cc Tue Jan 20 15:47:14 2009 -0800
24.2 +++ b/src/helper/packet-sink-helper.cc Tue Jan 20 17:39:18 2009 -0800
24.3 @@ -21,6 +21,7 @@
24.4 #include "packet-sink-helper.h"
24.5 #include "ns3/string.h"
24.6 #include "ns3/inet-socket-address.h"
24.7 +#include "ns3/object-names.h"
24.8
24.9 namespace ns3 {
24.10
24.11 @@ -60,6 +61,13 @@
24.12 }
24.13
24.14 ApplicationContainer
24.15 +PacketSinkHelper::Install (std::string nodeName) const
24.16 +{
24.17 + Ptr<Node> node = Names::Find<Node> (nodeName);
24.18 + return ApplicationContainer (InstallPriv (node));
24.19 +}
24.20 +
24.21 +ApplicationContainer
24.22 PacketSinkHelper::Install (NodeContainer c) const
24.23 {
24.24 ApplicationContainer apps;
25.1 --- a/src/helper/packet-sink-helper.h Tue Jan 20 15:47:14 2009 -0800
25.2 +++ b/src/helper/packet-sink-helper.h Tue Jan 20 17:39:18 2009 -0800
25.3 @@ -47,9 +47,16 @@
25.4 * Install an ns3::PacketSinkApplication on each node of the input container
25.5 * configured with all the attributes set with SetAttribute.
25.6 *
25.7 - * \param c The node on which a PacketSinkApplication will be installed.
25.8 + * \param node The node on which a PacketSinkApplication will be installed.
25.9 */
25.10 ApplicationContainer Install (Ptr<Node> node) const;
25.11 + /**
25.12 + * Install an ns3::PacketSinkApplication on each node of the input container
25.13 + * configured with all the attributes set with SetAttribute.
25.14 + *
25.15 + * \param nodeName The name of the node on which a PacketSinkApplication will be installed.
25.16 + */
25.17 + ApplicationContainer Install (std::string nodeName) const;
25.18
25.19 private:
25.20 Ptr<Application> InstallPriv (Ptr<Node> node) const;
26.1 --- a/src/helper/packet-socket-helper.cc Tue Jan 20 15:47:14 2009 -0800
26.2 +++ b/src/helper/packet-socket-helper.cc Tue Jan 20 17:39:18 2009 -0800
26.3 @@ -20,6 +20,7 @@
26.4
26.5 #include "packet-socket-helper.h"
26.6 #include "ns3/packet-socket-factory.h"
26.7 +#include "ns3/object-names.h"
26.8
26.9 namespace ns3 {
26.10
26.11 @@ -35,8 +36,15 @@
26.12 void
26.13 PacketSocketHelper::Install (Ptr<Node> node) const
26.14 {
26.15 - Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
26.16 - node->AggregateObject (factory);
26.17 + Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
26.18 + node->AggregateObject (factory);
26.19 +}
26.20 +
26.21 +void
26.22 +PacketSocketHelper::Install (std::string nodeName) const
26.23 +{
26.24 + Ptr<Node> node = Names::Find<Node> (nodeName);
26.25 + Install (node);
26.26 }
26.27
26.28 } // namespace ns3
27.1 --- a/src/helper/packet-socket-helper.h Tue Jan 20 15:47:14 2009 -0800
27.2 +++ b/src/helper/packet-socket-helper.h Tue Jan 20 17:39:18 2009 -0800
27.3 @@ -40,6 +40,14 @@
27.4 void Install (Ptr<Node> node) const;
27.5
27.6 /**
27.7 + * Aggregate an instance of a ns3::PacketSocketFactory onto the provided
27.8 + * node.
27.9 + *
27.10 + * \param nodeName The name of the node on which to aggregate the ns3::PacketSocketFactory.
27.11 + */
27.12 + void Install (std::string nodeName) const;
27.13 +
27.14 + /**
27.15 * For each node in the provided container, aggregate an instance of a
27.16 * ns3::PacketSocketFactory.
27.17 *
28.1 --- a/src/helper/point-to-point-helper.cc Tue Jan 20 15:47:14 2009 -0800
28.2 +++ b/src/helper/point-to-point-helper.cc Tue Jan 20 17:39:18 2009 -0800
28.3 @@ -25,7 +25,7 @@
28.4 #include "ns3/pcap-writer.h"
28.5 #include "ns3/config.h"
28.6 #include "ns3/packet.h"
28.7 -
28.8 +#include "ns3/object-names.h"
28.9
28.10 namespace ns3 {
28.11
28.12 @@ -204,6 +204,28 @@
28.13 return container;
28.14 }
28.15
28.16 +NetDeviceContainer
28.17 +PointToPointHelper::Install (Ptr<Node> a, std::string bName)
28.18 +{
28.19 + Ptr<Node> b = Names::Find<Node> (bName);
28.20 + return Install (a, b);
28.21 +}
28.22 +
28.23 +NetDeviceContainer
28.24 +PointToPointHelper::Install (std::string aName, Ptr<Node> b)
28.25 +{
28.26 + Ptr<Node> a = Names::Find<Node> (aName);
28.27 + return Install (a, b);
28.28 +}
28.29 +
28.30 +NetDeviceContainer
28.31 +PointToPointHelper::Install (std::string aName, std::string bName)
28.32 +{
28.33 + Ptr<Node> a = Names::Find<Node> (aName);
28.34 + Ptr<Node> b = Names::Find<Node> (bName);
28.35 + return Install (a, b);
28.36 +}
28.37 +
28.38 void
28.39 PointToPointHelper::InstallStar (Ptr<Node> hub, NodeContainer spokes,
28.40 NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices)
28.41 @@ -217,6 +239,14 @@
28.42 }
28.43
28.44 void
28.45 +PointToPointHelper::InstallStar (std::string hubName, NodeContainer spokes,
28.46 + NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices)
28.47 +{
28.48 + Ptr<Node> hub = Names::Find<Node> (hubName);
28.49 + InstallStar (hub, spokes, hubDevices, spokeDevices);
28.50 +}
28.51 +
28.52 +void
28.53 PointToPointHelper::EnqueueEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet)
28.54 {
28.55 writer->WritePacket (packet);
29.1 --- a/src/helper/point-to-point-helper.h Tue Jan 20 15:47:14 2009 -0800
29.2 +++ b/src/helper/point-to-point-helper.h Tue Jan 20 17:39:18 2009 -0800
29.3 @@ -180,6 +180,30 @@
29.4 NetDeviceContainer Install (Ptr<Node> a, Ptr<Node> b);
29.5
29.6 /**
29.7 + * \param a first node
29.8 + * \param bName name of second node
29.9 + *
29.10 + * Saves you from having to construct a temporary NodeContainer.
29.11 + */
29.12 + NetDeviceContainer Install (Ptr<Node> a, std::string bName);
29.13 +
29.14 + /**
29.15 + * \param aName Name of first node
29.16 + * \param b second node
29.17 + *
29.18 + * Saves you from having to construct a temporary NodeContainer.
29.19 + */
29.20 + NetDeviceContainer Install (std::string aName, Ptr<Node> b);
29.21 +
29.22 + /**
29.23 + * \param aName Name of first node
29.24 + * \param bName Name of second node
29.25 + *
29.26 + * Saves you from having to construct a temporary NodeContainer.
29.27 + */
29.28 + NetDeviceContainer Install (std::string aNode, std::string bNode);
29.29 +
29.30 + /**
29.31 * \brief Make a star network topology.
29.32 *
29.33 * Given a pointer to a node that will become the hub of the star, and a
29.34 @@ -207,6 +231,34 @@
29.35 void InstallStar (Ptr<Node> hub, NodeContainer spokes,
29.36 NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
29.37
29.38 + /**
29.39 + * \brief Make a star network topology.
29.40 + *
29.41 + * Given a pointer to a node that will become the hub of the star, and a
29.42 + * NodeContainer containing pointers to the nodes that will become the
29.43 + * spokes; we construct point to point net devices on the hub (corresponding
29.44 + * to the spokes) and store them in the hubDevices NetDeviceContainer. We
29.45 + * add a net device to each spoke node and store them in the spokeDevices
29.46 + * NetDeviceContainer. A point-to-point channel is created for each spoke.
29.47 + *
29.48 + * The ordering of the devices in the hubDevices container is according to
29.49 + * the order of the spokes container -- that is, hubDevices[0] will be the
29.50 + * net device used on the hub that talks to spokes[0]. the container entry
29.51 + * spokeDevices[0] will have the device that hubDevices[0] talks to -- those
29.52 + * two devices are the ones that connect hub to spokes[0].
29.53 + *
29.54 + * \param hubName The name of the central node of the star network
29.55 + * \param spokes A NodeContainer of the nodes that will be the spoke (leaf)
29.56 + * nodes
29.57 + * \param hubDevices A NetDeviceContainer that will be filled with pointers
29.58 + * to the point-to-point net devices created on the hub.
29.59 + * \param spokeDevices A NetDeviceContainer that will be filled with pointers
29.60 + * to the point-to-point net devices created on each of
29.61 + * the spokes.
29.62 + */
29.63 + void InstallStar (std::string hubName, NodeContainer spokes,
29.64 + NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
29.65 +
29.66 private:
29.67 void EnablePcap (Ptr<Node> node, Ptr<NetDevice> device, Ptr<Queue> queue);
29.68 void EnableAscii (Ptr<Node> node, Ptr<NetDevice> device);
30.1 --- a/src/helper/static-multicast-route-helper.cc Tue Jan 20 15:47:14 2009 -0800
30.2 +++ b/src/helper/static-multicast-route-helper.cc Tue Jan 20 17:39:18 2009 -0800
30.3 @@ -23,6 +23,7 @@
30.4 #include "ns3/assert.h"
30.5 #include "ns3/ipv4-address.h"
30.6 #include "ns3/ipv4.h"
30.7 +#include "ns3/object-names.h"
30.8 #include "static-multicast-route-helper.h"
30.9
30.10 namespace ns3 {
30.11 @@ -53,6 +54,43 @@
30.12 ipv4->AddMulticastRoute (source, group, iifIndex, outputInterfaces);
30.13 }
30.14
30.15 +void
30.16 +StaticMulticastRouteHelper::AddMulticastRoute (
30.17 + Ptr<Node> n,
30.18 + Ipv4Address source,
30.19 + Ipv4Address group,
30.20 + std::string inputName,
30.21 + NetDeviceContainer output)
30.22 +{
30.23 + Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
30.24 + AddMulticastRoute (n, source, group, input, output);
30.25 +}
30.26 +
30.27 +void
30.28 +StaticMulticastRouteHelper::AddMulticastRoute (
30.29 + std::string nName,
30.30 + Ipv4Address source,
30.31 + Ipv4Address group,
30.32 + Ptr<NetDevice> input,
30.33 + NetDeviceContainer output)
30.34 +{
30.35 + Ptr<Node> n = Names::Find<Node> (nName);
30.36 + AddMulticastRoute (n, source, group, input, output);
30.37 +}
30.38 +
30.39 +void
30.40 +StaticMulticastRouteHelper::AddMulticastRoute (
30.41 + std::string nName,
30.42 + Ipv4Address source,
30.43 + Ipv4Address group,
30.44 + std::string inputName,
30.45 + NetDeviceContainer output)
30.46 +{
30.47 + Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
30.48 + Ptr<Node> n = Names::Find<Node> (nName);
30.49 + AddMulticastRoute (n, source, group, input, output);
30.50 +}
30.51 +
30.52 void
30.53 StaticMulticastRouteHelper::SetDefaultMulticastRoute (
30.54 Ptr<Node> n,
30.55 @@ -64,6 +102,34 @@
30.56 }
30.57
30.58 void
30.59 +StaticMulticastRouteHelper::SetDefaultMulticastRoute (
30.60 + Ptr<Node> n,
30.61 + std::string ndName)
30.62 +{
30.63 + Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
30.64 + SetDefaultMulticastRoute (n, nd);
30.65 +}
30.66 +
30.67 +void
30.68 +StaticMulticastRouteHelper::SetDefaultMulticastRoute (
30.69 + std::string nName,
30.70 + Ptr<NetDevice> nd)
30.71 +{
30.72 + Ptr<Node> n = Names::Find<Node> (nName);
30.73 + SetDefaultMulticastRoute (n, nd);
30.74 +}
30.75 +
30.76 +void
30.77 +StaticMulticastRouteHelper::SetDefaultMulticastRoute (
30.78 + std::string nName,
30.79 + std::string ndName)
30.80 +{
30.81 + Ptr<Node> n = Names::Find<Node> (nName);
30.82 + Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
30.83 + SetDefaultMulticastRoute (n, nd);
30.84 +}
30.85 +
30.86 +void
30.87 StaticMulticastRouteHelper::JoinMulticastGroup (
30.88 Ptr<Node> n,
30.89 Ipv4Address source,
30.90 @@ -73,5 +139,15 @@
30.91 ipv4->JoinMulticastGroup (source, group);
30.92 }
30.93
30.94 +void
30.95 +StaticMulticastRouteHelper::JoinMulticastGroup (
30.96 + std::string nName,
30.97 + Ipv4Address source,
30.98 + Ipv4Address group)
30.99 +{
30.100 + Ptr<Node> n = Names::Find<Node> (nName);
30.101 + JoinMulticastGroup (n, source, group);
30.102 +}
30.103 +
30.104 } // namespace ns3
30.105
31.1 --- a/src/helper/static-multicast-route-helper.h Tue Jan 20 15:47:14 2009 -0800
31.2 +++ b/src/helper/static-multicast-route-helper.h Tue Jan 20 17:39:18 2009 -0800
31.3 @@ -34,13 +34,22 @@
31.4 public:
31.5 StaticMulticastRouteHelper ();
31.6
31.7 - void AddMulticastRoute (Ptr<Node>, Ipv4Address source, Ipv4Address group,
31.8 + void AddMulticastRoute (Ptr<Node> n, Ipv4Address source, Ipv4Address group,
31.9 Ptr<NetDevice> input, NetDeviceContainer output);
31.10 + void AddMulticastRoute (std::string n, Ipv4Address source, Ipv4Address group,
31.11 + Ptr<NetDevice> input, NetDeviceContainer output);
31.12 + void AddMulticastRoute (Ptr<Node> n, Ipv4Address source, Ipv4Address group,
31.13 + std::string inputName, NetDeviceContainer output);
31.14 + void AddMulticastRoute (std::string nName, Ipv4Address source, Ipv4Address group,
31.15 + std::string inputName, NetDeviceContainer output);
31.16
31.17 void SetDefaultMulticastRoute (Ptr<Node> n, Ptr<NetDevice> nd);
31.18 + void SetDefaultMulticastRoute (Ptr<Node> n, std::string ndName);
31.19 + void SetDefaultMulticastRoute (std::string nName, Ptr<NetDevice> nd);
31.20 + void SetDefaultMulticastRoute (std::string nName, std::string ndName);
31.21
31.22 void JoinMulticastGroup (Ptr<Node> n, Ipv4Address source, Ipv4Address group);
31.23 -
31.24 + void JoinMulticastGroup (std::string nName, Ipv4Address source, Ipv4Address group);
31.25 };
31.26
31.27 } // namespace ns3
32.1 --- a/src/helper/udp-echo-helper.cc Tue Jan 20 15:47:14 2009 -0800
32.2 +++ b/src/helper/udp-echo-helper.cc Tue Jan 20 17:39:18 2009 -0800
32.3 @@ -21,6 +21,7 @@
32.4 #include "ns3/udp-echo-server.h"
32.5 #include "ns3/udp-echo-client.h"
32.6 #include "ns3/uinteger.h"
32.7 +#include "ns3/object-names.h"
32.8
32.9 namespace ns3 {
32.10
32.11 @@ -45,6 +46,13 @@
32.12 }
32.13
32.14 ApplicationContainer
32.15 +UdpEchoServerHelper::Install (std::string nodeName) const
32.16 +{
32.17 + Ptr<Node> node = Names::Find<Node> (nodeName);
32.18 + return ApplicationContainer (InstallPriv (node));
32.19 +}
32.20 +
32.21 +ApplicationContainer
32.22 UdpEchoServerHelper::Install (NodeContainer c) const
32.23 {
32.24 ApplicationContainer apps;
32.25 @@ -87,6 +95,13 @@
32.26 }
32.27
32.28 ApplicationContainer
32.29 +UdpEchoClientHelper::Install (std::string nodeName) const
32.30 +{
32.31 + Ptr<Node> node = Names::Find<Node> (nodeName);
32.32 + return ApplicationContainer (InstallPriv (node));
32.33 +}
32.34 +
32.35 +ApplicationContainer
32.36 UdpEchoClientHelper::Install (NodeContainer c) const
32.37 {
32.38 ApplicationContainer apps;
33.1 --- a/src/helper/udp-echo-helper.h Tue Jan 20 15:47:14 2009 -0800
33.2 +++ b/src/helper/udp-echo-helper.h Tue Jan 20 17:39:18 2009 -0800
33.3 @@ -36,6 +36,7 @@
33.4 void SetAttribute (std::string name, const AttributeValue &value);
33.5
33.6 ApplicationContainer Install (Ptr<Node> node) const;
33.7 + ApplicationContainer Install (std::string nodeName) const;
33.8 ApplicationContainer Install (NodeContainer c) const;
33.9
33.10 private:
33.11 @@ -52,6 +53,7 @@
33.12 void SetAttribute (std::string name, const AttributeValue &value);
33.13
33.14 ApplicationContainer Install (Ptr<Node> node) const;
33.15 + ApplicationContainer Install (std::string nodeName) const;
33.16 ApplicationContainer Install (NodeContainer c) const;
33.17
33.18 private:
34.1 --- a/src/helper/v4ping-helper.cc Tue Jan 20 15:47:14 2009 -0800
34.2 +++ b/src/helper/v4ping-helper.cc Tue Jan 20 17:39:18 2009 -0800
34.3 @@ -1,5 +1,26 @@
34.4 +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
34.5 +/*
34.6 + * Copyright (c) 2008 INRIA
34.7 + *
34.8 + * This program is free software; you can redistribute it and/or modify
34.9 + * it under the terms of the GNU General Public License version 2 as
34.10 + * published by the Free Software Foundation;
34.11 + *
34.12 + * This program is distributed in the hope that it will be useful,
34.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
34.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34.15 + * GNU General Public License for more details.
34.16 + *
34.17 + * You should have received a copy of the GNU General Public License
34.18 + * along with this program; if not, write to the Free Software
34.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34.20 + *
34.21 + * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
34.22 + */
34.23 +
34.24 #include "v4ping-helper.h"
34.25 #include "ns3/v4ping.h"
34.26 +#include "ns3/object-names.h"
34.27
34.28 namespace ns3 {
34.29
34.30 @@ -22,6 +43,13 @@
34.31 }
34.32
34.33 ApplicationContainer
34.34 +V4PingHelper::Install (std::string nodeName) const
34.35 +{
34.36 + Ptr<Node> node = Names::Find<Node> (nodeName);
34.37 + return ApplicationContainer (InstallPriv (node));
34.38 +}
34.39 +
34.40 +ApplicationContainer
34.41 V4PingHelper::Install (NodeContainer c) const
34.42 {
34.43 ApplicationContainer apps;
35.1 --- a/src/helper/v4ping-helper.h Tue Jan 20 15:47:14 2009 -0800
35.2 +++ b/src/helper/v4ping-helper.h Tue Jan 20 17:39:18 2009 -0800
35.3 @@ -16,6 +16,7 @@
35.4
35.5 ApplicationContainer Install (NodeContainer nodes) const;
35.6 ApplicationContainer Install (Ptr<Node> node) const;
35.7 + ApplicationContainer Install (std::string nodeName) const;
35.8
35.9 private:
35.10 Ptr<Application> InstallPriv (Ptr<Node> node) const;
36.1 --- a/src/helper/wifi-helper.cc Tue Jan 20 15:47:14 2009 -0800
36.2 +++ b/src/helper/wifi-helper.cc Tue Jan 20 17:39:18 2009 -0800
36.3 @@ -31,8 +31,7 @@
36.4 #include "ns3/pcap-writer.h"
36.5 #include "ns3/config.h"
36.6 #include "ns3/simulator.h"
36.7 -
36.8 -
36.9 +#include "ns3/object-names.h"
36.10
36.11 NS_LOG_COMPONENT_DEFINE ("WifiHelper");
36.12
36.13 @@ -126,6 +125,11 @@
36.14 {
36.15 return Install (phy, NodeContainer (node));
36.16 }
36.17 -
36.18 +NetDeviceContainer
36.19 +WifiHelper::Install (const WifiPhyHelper &phy, std::string nodeName) const
36.20 +{
36.21 + Ptr<Node> node = Names::Find<Node> (nodeName);
36.22 + return Install (phy, NodeContainer (node));
36.23 +}
36.24
36.25 } // namespace ns3
37.1 --- a/src/helper/wifi-helper.h Tue Jan 20 15:47:14 2009 -0800
37.2 +++ b/src/helper/wifi-helper.h Tue Jan 20 17:39:18 2009 -0800
37.3 @@ -153,6 +153,12 @@
37.4 * \returns a device container which contains all the devices created by this method.
37.5 */
37.6 NetDeviceContainer Install (const WifiPhyHelper &phy, Ptr<Node> node) const;
37.7 + /**
37.8 + * \param phy the PHY helper to create PHY objects
37.9 + * \param nodeName the name of node on which a wifi device must be created
37.10 + * \returns a device container which contains all the devices created by this method.
37.11 + */
37.12 + NetDeviceContainer Install (const WifiPhyHelper &phy, std::string nodeName) const;
37.13
37.14 private:
37.15 ObjectFactory m_stationManager;
38.1 --- a/src/helper/yans-wifi-helper.cc Tue Jan 20 15:47:14 2009 -0800
38.2 +++ b/src/helper/yans-wifi-helper.cc Tue Jan 20 17:39:18 2009 -0800
38.3 @@ -27,6 +27,7 @@
38.4 #include "ns3/pcap-writer.h"
38.5 #include "ns3/simulator.h"
38.6 #include "ns3/config.h"
38.7 +#include "ns3/object-names.h"
38.8
38.9 namespace ns3 {
38.10
38.11 @@ -164,6 +165,12 @@
38.12 m_channel = channel;
38.13 }
38.14 void
38.15 +YansWifiPhyHelper::SetChannel (std::string channelName)
38.16 +{
38.17 + Ptr<YansWifiChannel> channel = Names::Find<YansWifiChannel> (channelName);
38.18 + m_channel = channel;
38.19 +}
38.20 +void
38.21 YansWifiPhyHelper::Set (std::string name, const AttributeValue &v)
38.22 {
38.23 m_phy.Set (name, v);
38.24 @@ -192,7 +199,6 @@
38.25 m_errorRateModel.Set (n7, v7);
38.26 }
38.27
38.28 -
38.29 Ptr<WifiPhy>
38.30 YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const
38.31 {
39.1 --- a/src/helper/yans-wifi-helper.h Tue Jan 20 15:47:14 2009 -0800
39.2 +++ b/src/helper/yans-wifi-helper.h Tue Jan 20 17:39:18 2009 -0800
39.3 @@ -155,6 +155,12 @@
39.4 */
39.5 void SetChannel (Ptr<YansWifiChannel> channel);
39.6 /**
39.7 + * \param channelName The name of the channel to associate to this helper
39.8 + *
39.9 + * Every PHY created by a call to Install is associated to this channel.
39.10 + */
39.11 + void SetChannel (std::string channelName);
39.12 + /**
39.13 * \param name the name of the attribute to set
39.14 * \param v the value of the attribute
39.15 *