--- a/examples/names.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/examples/names.cc Tue Jan 20 17:39:18 2009 -0800
@@ -22,7 +22,6 @@
// LAN
//
-#include <fstream>
#include "ns3/core-module.h"
#include "ns3/simulator-module.h"
#include "ns3/helper-module.h"
@@ -40,25 +39,13 @@
int
main (int argc, char *argv[])
{
- //
- // Users may find it convenient to turn on explicit debugging
- // for selected modules; the below lines suggest how to do this
- //
#if 1
LogComponentEnable ("NamesExample", LOG_LEVEL_INFO);
#endif
- //
- // Allow the user to override any of the defaults and the above Bind() at
- // run-time, via command-line arguments
- //
CommandLine cmd;
cmd.Parse (argc, argv);
- //
- // Explicitly create the nodes required by the topology (shown above).
- //
- NS_LOG_INFO ("Create nodes.");
NodeContainer n;
n.Create (4);
@@ -75,7 +62,6 @@
InternetStackHelper internet;
internet.Install (n);
- NS_LOG_INFO ("Create devices.");
CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000)));
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));
@@ -94,31 +80,19 @@
Names::Add ("/Names/server", "eth0", d.Get (1));
Ipv4AddressHelper ipv4;
-
- //
- // We've got the "hardware" in place. Now we need to add IP addresses.
- //
- NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (d);
- NS_LOG_INFO ("Create Applications.");
-
+ uint16_t port = 9;
+ UdpEchoServerHelper server (port);
//
- // Create a UdpEchoServer application on the server node. Note that we
- // reference the server node by name in the Install method below.
+ // Install the UdpEchoServer application on the server node using its name
+ // directly.
//
- uint16_t port = 9; // well-known echo port number
- UdpEchoServerHelper server (port);
- ApplicationContainer apps = server.Install (Names::Find<Node> ("/Names/server"));
+ ApplicationContainer apps = server.Install ("/Names/server");
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
- //
- // Create a UdpEchoClient application to send UDP datagrams from node zero to
- // node one. Notice that we reference the client node by name in the Install
- // method below.
- //
uint32_t packetSize = 1024;
uint32_t maxPacketCount = 1;
Time interPacketInterval = Seconds (1.);
@@ -126,17 +100,20 @@
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
client.SetAttribute ("Interval", TimeValue (interPacketInterval));
client.SetAttribute ("PacketSize", UintegerValue (packetSize));
- apps = client.Install (Names::Find<Node> ("/Names/client"));
+ //
+ // Install the UdpEchoClient application on the server node using its name
+ // directly.
+ //
+ apps = client.Install ("/Names/client");
apps.Start (Seconds (2.0));
apps.Stop (Seconds (10.0));
+ //
+ // Use the config system to connect a trace source using the object name
+ // system to specify the path.
+ //
Config::Connect ("/Names/client/eth0/Rx", MakeCallback (&RxEvent));
- //
- // Now, do the actual simulation.
- //
- NS_LOG_INFO ("Run Simulation.");
Simulator::Run ();
Simulator::Destroy ();
- NS_LOG_INFO ("Done.");
}
--- a/src/helper/application-container.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/application-container.cc Tue Jan 20 17:39:18 2009 -0800
@@ -17,6 +17,8 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
+#include "ns3/object-names.h"
#include "application-container.h"
namespace ns3 {
@@ -29,6 +31,13 @@
m_applications.push_back (app);
}
+ApplicationContainer::ApplicationContainer (std::string name)
+{
+ Ptr<Application> app = Names::Find<Application> (name);
+ m_applications.push_back (app);
+}
+
+
ApplicationContainer::Iterator
ApplicationContainer::Begin (void) const
{
@@ -63,6 +72,12 @@
{
m_applications.push_back (application);
}
+void
+ApplicationContainer::Add (std::string name)
+{
+ Ptr<Application> application = Names::Find<Application> (name);
+ m_applications.push_back (application);
+}
void
ApplicationContainer::Start (Time start)
--- a/src/helper/application-container.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/application-container.h Tue Jan 20 17:39:18 2009 -0800
@@ -17,6 +17,7 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#ifndef APPLICATION_CONTAINER_H
#define APPLICATION_CONTAINER_H
@@ -45,6 +46,13 @@
*/
ApplicationContainer (Ptr<Application> application);
+ /**
+ * Create an ApplicationContainer with exactly one application
+ *
+ * \param name The name of the application object to add to the container
+ */
+ ApplicationContainer (std::string name);
+
typedef std::vector<Ptr<Application> >::const_iterator Iterator;
/**
@@ -57,27 +65,33 @@
Iterator End (void) const;
/**
- * \returns the number of netdevice pointers stored in this container.
+ * \returns the number of application pointers stored in this container.
*/
uint32_t GetN (void) const;
/**
- * \param i the index of the requested netdevice pointer.
- * \returns the requested netdevice pointer.
+ * \param i the index of the requested application pointer.
+ * \returns the requested application pointer.
*/
Ptr<Application> Get (uint32_t i) const;
/**
- * \param other another netdevice container
+ * Append to the end of this container the other input container.
*
- * Append to the end of this container the other input container.
+ * \param other another application container
*/
void Add (ApplicationContainer other);
/**
- * \param application another netdevice pointer.
+ * Append to the end of this container the input application pointer.
*
- * Append to the end of this container the input netdevice pointer.
+ * \param application another netdevice pointer.
*/
void Add (Ptr<Application> application);
+ /**
+ * Append to the end of this container the application specified by the name.
+ *
+ * \param name The name of the application object to add to the container.
+ */
+ void Add (std::string name);
void Start (Time start);
void Stop (Time stop);
--- a/src/helper/bridge-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/bridge-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -20,6 +20,7 @@
#include "ns3/log.h"
#include "ns3/bridge-net-device.h"
#include "ns3/node.h"
+#include "ns3/object-names.h"
NS_LOG_COMPONENT_DEFINE ("BridgeHelper");
@@ -57,4 +58,12 @@
return devs;
}
+NetDeviceContainer
+BridgeHelper::Install (std::string nodeName, NetDeviceContainer c)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return Install (node, c);
+}
+
} // namespace ns3
--- a/src/helper/bridge-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/bridge-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -16,6 +16,7 @@
BridgeHelper ();
void SetDeviceAttribute (std::string n1, const AttributeValue &v1);
NetDeviceContainer Install (Ptr<Node> node, NetDeviceContainer c);
+ NetDeviceContainer Install (std::string nodeName, NetDeviceContainer c);
private:
ObjectFactory m_deviceFactory;
};
--- a/src/helper/csma-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/csma-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -26,6 +26,7 @@
#include "ns3/pcap-writer.h"
#include "ns3/config.h"
#include "ns3/packet.h"
+#include "ns3/object-names.h"
#include <string>
namespace ns3 {
@@ -181,11 +182,40 @@
}
NetDeviceContainer
+CsmaHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return Install (node);
+}
+
+NetDeviceContainer
CsmaHelper::Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const
{
return NetDeviceContainer (InstallPriv (node, channel));
}
+NetDeviceContainer
+CsmaHelper::Install (Ptr<Node> node, std::string channelName) const
+{
+ Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName);
+ return NetDeviceContainer (InstallPriv (node, channel));
+}
+
+NetDeviceContainer
+CsmaHelper::Install (std::string nodeName, Ptr<CsmaChannel> channel) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return NetDeviceContainer (InstallPriv (node, channel));
+}
+
+NetDeviceContainer
+CsmaHelper::Install (std::string nodeName, std::string channelName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName);
+ return NetDeviceContainer (InstallPriv (node, channel));
+}
+
NetDeviceContainer
CsmaHelper::Install (const NodeContainer &c) const
{
@@ -207,6 +237,13 @@
return devs;
}
+NetDeviceContainer
+CsmaHelper::Install (const NodeContainer &c, std::string channelName) const
+{
+ Ptr<CsmaChannel> channel = Names::Find<CsmaChannel> (channelName);
+ return Install (c, channel);
+}
+
Ptr<NetDevice>
CsmaHelper::InstallPriv (Ptr<Node> node, Ptr<CsmaChannel> channel) const
{
@@ -234,6 +271,14 @@
}
void
+CsmaHelper::InstallStar (std::string hubName, NodeContainer spokes,
+ NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices)
+{
+ Ptr<Node> hub = Names::Find<Node> (hubName);
+ InstallStar (hub, spokes, hubDevices, spokeDevices);
+}
+
+void
CsmaHelper::EnqueueEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet)
{
writer->WritePacket (packet);
--- a/src/helper/csma-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/csma-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -172,15 +172,59 @@
NetDeviceContainer Install (Ptr<Node> node) const;
/**
+ * This method creates an ns3::CsmaChannel with the attributes configured by
+ * CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes
+ * configured by CsmaHelper::SetDeviceAttribute and then adds the device
+ * to the node and attaches the channel to the device.
+ *
+ * \param name The name of the node to install the device in
+ * \returns A containter holding the added net device.
+ */
+ NetDeviceContainer Install (std::string name) const;
+
+ /**
+ * This method creates an ns3::CsmaNetDevice with the attributes configured by
+ * CsmaHelper::SetDeviceAttribute and then adds the device to the node and
+ * attaches the provided channel to the device.
+ *
+ * \param node The node to install the device in
+ * \param channel The channel to attach to the device.
+ * \returns A containter holding the added net device.
+ */
+ NetDeviceContainer Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const;
+
+ /**
* This method creates an ns3::CsmaNetDevice with the attributes configured by
* CsmaHelper::SetDeviceAttribute and then adds the device to the node and
* attaches the provided channel to the device.
*
* \param node The node to install the device in
+ * \param channelName The name of the channel to attach to the device.
+ * \returns A containter holding the added net device.
+ */
+ NetDeviceContainer Install (Ptr<Node> node, std::string channelName) const;
+
+ /**
+ * This method creates an ns3::CsmaNetDevice with the attributes configured by
+ * CsmaHelper::SetDeviceAttribute and then adds the device to the node and
+ * attaches the provided channel to the device.
+ *
+ * \param nodeName The name of the node to install the device in
* \param channel The chanel to attach to the device.
* \returns A containter holding the added net device.
*/
- NetDeviceContainer Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const;
+ NetDeviceContainer Install (std::string nodeName, Ptr<CsmaChannel> channel) const;
+
+ /**
+ * This method creates an ns3::CsmaNetDevice with the attributes configured by
+ * CsmaHelper::SetDeviceAttribute and then adds the device to the node and
+ * attaches the provided channel to the device.
+ *
+ * \param nodeName The name of the node to install the device in
+ * \param channelName The name of the chanel to attach to the device.
+ * \returns A containter holding the added net device.
+ */
+ NetDeviceContainer Install (std::string nodeName, std::string channelName) const;
/**
* This method creates an ns3::CsmaChannel with the attributes configured by
@@ -207,6 +251,18 @@
NetDeviceContainer Install (const NodeContainer &c, Ptr<CsmaChannel> channel) const;
/**
+ * For each Ptr<node> in the provided container, this method creates an
+ * ns3::CsmaNetDevice (with the attributes configured by
+ * CsmaHelper::SetDeviceAttribute); adds the device to the node; and attaches
+ * the provided channel to the device.
+ *
+ * \param c The NodeContainer holding the nodes to be changed.
+ * \param channelName The name of the channel to attach to the devices.
+ * \returns A containter holding the added net devices.
+ */
+ NetDeviceContainer Install (const NodeContainer &c, std::string channelName) const;
+
+ /**
* \brief Make a star network topology.
*
* Given a pointer to a node that will become the hub of the star, and a
@@ -239,6 +295,39 @@
void InstallStar (Ptr<Node> hub, NodeContainer spokes,
NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
+ /**
+ * \brief Make a star network topology.
+ *
+ * Given a pointer to a node that will become the hub of the star, and a
+ * NodeContainer containing pointers to the nodes that will become the
+ * spokes; we construct CSMA net devices on the hub (corresponding to the
+ * spokes) and store them in the hubDevices NetDeviceContainer. We add a
+ * net device to each spoke node and store them in the spokeDevices
+ * NetDeviceContainer. A CSMA is created for each spoke.
+ *
+ * Usually when one thinks of a star network, one thinks of point-to-point
+ * links. We're just using a single pair of devices on a multi-point-to-point
+ * network "drops" as the link. You are free to add any number of other
+ * devices on the link if you want.
+ *
+ * The ordering of the devices in the hubDevices container is according to
+ * the order of the spokes container -- that is, hubDevices[0] will be the
+ * net device used on the hub that talks to spokes[0]. the container entry
+ * spokeDevices[0] will have the device that hubDevices[0] talks to -- those
+ * two devices are the ones that connect hub to spokes[0].
+ *
+ * \param hubName The name of the central node of the star network
+ * \param spokes A NodeContainer of the nodes that will be the spoke (leaf)
+ * nodes
+ * \param hubDevices A NetDeviceContainer that will be filled with pointers
+ * to the point-to-point net devices created on the hub.
+ * \param spokeDevices A NetDeviceContainer that will be filled with pointers
+ * to the point-to-point net devices created on each of
+ * the spokes.
+ */
+ void InstallStar (std::string hubName, NodeContainer spokes,
+ NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
+
private:
Ptr<NetDevice> InstallPriv (Ptr<Node> node, Ptr<CsmaChannel> channel) const;
@@ -253,7 +342,6 @@
ObjectFactory m_channelFactory;
};
-
} // namespace ns3
#endif /* CSMA_HELPER_H */
--- a/src/helper/emu-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/emu-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -21,6 +21,7 @@
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "ns3/object-factory.h"
+#include "ns3/object-names.h"
#include "ns3/queue.h"
#include "ns3/emu-net-device.h"
#include "ns3/pcap-writer.h"
@@ -194,6 +195,13 @@
return NetDeviceContainer (InstallPriv (node));
}
+NetDeviceContainer
+EmuHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return NetDeviceContainer (InstallPriv (node));
+}
+
NetDeviceContainer
EmuHelper::Install (const NodeContainer &c) const
{
--- a/src/helper/emu-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/emu-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -164,6 +164,15 @@
NetDeviceContainer Install (Ptr<Node> node) const;
/**
+ * This method creates an ns3::EmuNetDevice with the attributes configured by
+ * EmuHelper::SetDeviceAttribute and then adds the device to the node.
+ *
+ * \param nodeName The name of the node to install the device in
+ * \returns A containter holding the added net device.
+ */
+ NetDeviceContainer Install (std::string nodeName) const;
+
+ /**
* For each Ptr<node> in the provided container this method creates an
* ns3::EmuNetDevice (with the attributes configured by
* EmuHelper::SetDeviceAttribute); adds the device to the node.
--- a/src/helper/internet-stack-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/internet-stack-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -21,6 +21,7 @@
#include "ns3/assert.h"
#include "ns3/log.h"
#include "ns3/object.h"
+#include "ns3/object-names.h"
#include "ns3/ipv4.h"
#include "internet-stack-helper.h"
#include "ns3/internet-stack.h"
@@ -92,6 +93,12 @@
}
void
+InternetStackHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ Install (node);
+}
+void
InternetStackHelper::EnableAscii (std::ostream &os, NodeContainer n)
{
Packet::EnablePrinting ();
--- a/src/helper/internet-stack-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/internet-stack-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -41,6 +41,15 @@
* onto the provided node. This method will assert if called on a node that
* already has an Ipv4 object aggregated to it.
*
+ * \param nodeName The name of the node on which to install the stack.
+ */
+ void Install (std::string nodeName) const;
+
+ /**
+ * Aggregate implementations of the ns3::Ipv4, ns3::Udp, and ns3::Tcp classes
+ * onto the provided node. This method will assert if called on a node that
+ * already has an Ipv4 object aggregated to it.
+ *
* \param node The node on which to install the stack.
*/
void Install (Ptr<Node> node) const;
--- a/src/helper/ipv4-interface-container.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/ipv4-interface-container.cc Tue Jan 20 17:39:18 2009 -0800
@@ -1,5 +1,6 @@
#include "ipv4-interface-container.h"
#include "ns3/node-list.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -40,5 +41,11 @@
{
m_interfaces.push_back (std::make_pair (ipv4, interface));
}
+void
+Ipv4InterfaceContainer::Add (std::string ipv4Name, uint32_t interface)
+{
+ Ptr<Ipv4> ipv4 = Names::Find<Ipv4> (ipv4Name);
+ m_interfaces.push_back (std::make_pair (ipv4, interface));
+}
} // namespace ns3
--- a/src/helper/ipv4-interface-container.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/ipv4-interface-container.h Tue Jan 20 17:39:18 2009 -0800
@@ -34,6 +34,7 @@
void SetMetric (uint32_t i, uint16_t metric);
void Add (Ptr<Ipv4> ipv4, uint32_t interface);
+ void Add (std::string ipv4Name, uint32_t interface);
private:
--- a/src/helper/mobility-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/mobility-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -25,6 +25,7 @@
#include "ns3/pointer.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
+#include "ns3/object-names.h"
#include <iostream>
namespace ns3 {
@@ -46,6 +47,12 @@
m_position = allocator;
}
void
+MobilityHelper::SetPositionAllocator (std::string allocatorName)
+{
+ Ptr<PositionAllocator> allocator = Names::Find<PositionAllocator> (allocatorName);
+ m_position = allocator;
+}
+void
MobilityHelper::SetPositionAllocator (std::string type,
std::string n1, const AttributeValue &v1,
std::string n2, const AttributeValue &v2,
@@ -101,6 +108,14 @@
Ptr<MobilityModel> mobility = reference->GetObject<MobilityModel> ();
m_mobilityStack.push_back (mobility);
}
+
+void
+MobilityHelper::PushReferenceMobilityModel (std::string referenceName)
+{
+ Ptr<MobilityModel> mobility = Names::Find<MobilityModel> (referenceName);
+ m_mobilityStack.push_back (mobility);
+}
+
void
MobilityHelper::PopReferenceMobilityModel (void)
{
@@ -147,6 +162,12 @@
model->SetPosition (position);
}
+void
+MobilityHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ Install (node);
+}
void
MobilityHelper::Install (NodeContainer c) const
{
--- a/src/helper/mobility-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/mobility-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -50,6 +50,13 @@
* \param allocator allocate initial node positions
*/
void SetPositionAllocator (Ptr<PositionAllocator> allocator);
+ /**
+ * Set the position allocator which will be used to allocate the initial
+ * position of every node initialized during MobilityModel::Install.
+ *
+ * \param allocator allocate initial node positions
+ */
+ void SetPositionAllocator (std::string allocatorName);
/**
* \param type the type of mobility model to use.
@@ -138,6 +145,25 @@
*/
void PushReferenceMobilityModel (Ptr<Object> reference);
/**
+ * \param reference item to push.
+ *
+ * Push an item on the top of the stack of "reference mobility models".
+ * The input item should be a node instance to which a mobility model
+ * has already been aggregated (usually by a call to Install).
+ *
+ * If this this stack is not empty when MobilityHelper::Install
+ * is called, the model from the top of the stack is used
+ * to create a ns3::HierarchicalMobilityModel to make the
+ * newly-created models define their positions relative to that
+ * of the parent mobility model.
+ *
+ * This method is typically used to create hierarchical mobility
+ * patterns and positions by starting with the large-scale mobility
+ * features, and, then, defining the smaller-scale movements relative
+ * to a few reference points in the large-scale model.
+ */
+ void PushReferenceMobilityModel (std::string referenceName);
+ /**
* Remove the top item from the top of the stack of
* "reference mobility models".
*/
@@ -161,6 +187,18 @@
* \param node The node to "layout."
*/
void Install (Ptr<Node> node) const;
+ /**
+ * \brief "Layout" a single node according to the current position allocator
+ * type.
+ *
+ * This method creates an instance of a ns3::MobilityModel subclass (the
+ * type of which was set with MobilityHelper::SetMobilityModel), aggregates
+ * it to the provided node, and sets an initial position based on the current
+ * position allocator (set through MobilityHelper::SetPositionAllocator).
+ *
+ * \param nodeName The name of the node to "layout."
+ */
+ void Install (std::string nodeName) const;
/**
* \brief Layout a collection of nodes according to the current position allocator
--- a/src/helper/net-device-container.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/net-device-container.cc Tue Jan 20 17:39:18 2009 -0800
@@ -17,7 +17,9 @@
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
+
#include "net-device-container.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -27,6 +29,11 @@
{
m_devices.push_back (dev);
}
+NetDeviceContainer::NetDeviceContainer (std::string devName)
+{
+ Ptr<NetDevice> dev = Names::Find<NetDevice> (devName);
+ m_devices.push_back (dev);
+}
NetDeviceContainer::NetDeviceContainer (const NetDeviceContainer &a, const NetDeviceContainer &b)
{
*this = a;
@@ -68,5 +75,11 @@
{
m_devices.push_back (device);
}
+void
+NetDeviceContainer::Add (std::string deviceName)
+{
+ Ptr<NetDevice> device = Names::Find<NetDevice> (deviceName);
+ m_devices.push_back (device);
+}
} // namespace ns3
--- a/src/helper/net-device-container.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/net-device-container.h Tue Jan 20 17:39:18 2009 -0800
@@ -46,6 +46,12 @@
*/
NetDeviceContainer (Ptr<NetDevice> dev);
/**
+ * \param devName The name of a device to add to the container
+ *
+ * Create a NetDeviceContainer with exactly one device
+ */
+ NetDeviceContainer (std::string devName);
+ /**
* \param a a device container
* \param b another device container
*
@@ -93,6 +99,12 @@
* Append to the end of this container the input netdevice pointer.
*/
void Add (Ptr<NetDevice> device);
+ /**
+ * \param deviceName The name of another netdevice to add.
+ *
+ * Append to the end of this container the input netdevice pointer.
+ */
+ void Add (std::string deviceName);
private:
std::vector<Ptr<NetDevice> > m_devices;
--- a/src/helper/node-container.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/node-container.cc Tue Jan 20 17:39:18 2009 -0800
@@ -19,6 +19,7 @@
*/
#include "node-container.h"
#include "ns3/node-list.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -29,6 +30,11 @@
{
m_nodes.push_back (node);
}
+NodeContainer::NodeContainer (std::string nodeName)
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ m_nodes.push_back (node);
+}
NodeContainer::NodeContainer (const NodeContainer &a, const NodeContainer &b)
{
Add (a);
@@ -103,6 +109,12 @@
{
m_nodes.push_back (node);
}
+void
+NodeContainer::Add (std::string nodeName)
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ m_nodes.push_back (node);
+}
NodeContainer
NodeContainer::GetGlobal (void)
--- a/src/helper/node-container.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/node-container.h Tue Jan 20 17:39:18 2009 -0800
@@ -46,6 +46,12 @@
*/
NodeContainer (Ptr<Node> node);
/**
+ * \param nodeName The name of a node to add to the container
+ *
+ * Create a NodeContainer with exactly one node.
+ */
+ NodeContainer (std::string nodeName);
+ /**
* \param a a node container
* \param b another node container
*
@@ -105,6 +111,12 @@
* Append the input node pointer at the end of this NodeContainer.
*/
void Add (Ptr<Node> node);
+ /**
+ * \param nodeName The name of a node
+ *
+ * Append the input node pointer at the end of this NodeContainer.
+ */
+ void Add (std::string nodeName);
/**
* \returns a container which contains a list of _all_ nodes
--- a/src/helper/olsr-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/olsr-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -20,6 +20,7 @@
#include "olsr-helper.h"
#include "ns3/olsr-agent.h"
#include "ns3/node-list.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -74,6 +75,12 @@
agent->Start ();
}
void
+OlsrHelper::Install (std::string nodeName)
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ Install (node);
+}
+void
OlsrHelper::InstallAll (void)
{
Install (NodeContainer::GetGlobal ());
--- a/src/helper/olsr-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/olsr-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -56,6 +56,10 @@
*/
void Install (Ptr<Node> node);
/**
+ * \brief Enable OLSR routing for a single node
+ */
+ void Install (std::string nodeName);
+ /**
* \brief Enable OLSR routing for all nodes
*/
void InstallAll (void);
--- a/src/helper/on-off-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/on-off-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -21,6 +21,7 @@
#include "ns3/inet-socket-address.h"
#include "ns3/packet-socket-address.h"
#include "ns3/string.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -44,6 +45,13 @@
}
ApplicationContainer
+OnOffHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
+}
+
+ApplicationContainer
OnOffHelper::Install (NodeContainer c) const
{
ApplicationContainer apps;
--- a/src/helper/on-off-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/on-off-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -72,6 +72,15 @@
*/
ApplicationContainer Install (Ptr<Node> node) const;
+ /**
+ * Install an ns3::OnOffApplication on the node configured with all the
+ * attributes set with SetAttribute.
+ *
+ * \param node The node on which an OnOffApplication will be installed.
+ * \returns Container of Ptr to the applications installed.
+ */
+ ApplicationContainer Install (std::string nodeName) const;
+
private:
/**
* Install an ns3::OnOffApplication on the node configured with all the
--- a/src/helper/packet-sink-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/packet-sink-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -21,6 +21,7 @@
#include "packet-sink-helper.h"
#include "ns3/string.h"
#include "ns3/inet-socket-address.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -60,6 +61,13 @@
}
ApplicationContainer
+PacketSinkHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
+}
+
+ApplicationContainer
PacketSinkHelper::Install (NodeContainer c) const
{
ApplicationContainer apps;
--- a/src/helper/packet-sink-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/packet-sink-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -47,9 +47,16 @@
* Install an ns3::PacketSinkApplication on each node of the input container
* configured with all the attributes set with SetAttribute.
*
- * \param c The node on which a PacketSinkApplication will be installed.
+ * \param node The node on which a PacketSinkApplication will be installed.
*/
ApplicationContainer Install (Ptr<Node> node) const;
+ /**
+ * Install an ns3::PacketSinkApplication on each node of the input container
+ * configured with all the attributes set with SetAttribute.
+ *
+ * \param nodeName The name of the node on which a PacketSinkApplication will be installed.
+ */
+ ApplicationContainer Install (std::string nodeName) const;
private:
Ptr<Application> InstallPriv (Ptr<Node> node) const;
--- a/src/helper/packet-socket-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/packet-socket-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -20,6 +20,7 @@
#include "packet-socket-helper.h"
#include "ns3/packet-socket-factory.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -35,8 +36,15 @@
void
PacketSocketHelper::Install (Ptr<Node> node) const
{
- Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
- node->AggregateObject (factory);
+ Ptr<PacketSocketFactory> factory = CreateObject<PacketSocketFactory> ();
+ node->AggregateObject (factory);
+}
+
+void
+PacketSocketHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ Install (node);
}
} // namespace ns3
--- a/src/helper/packet-socket-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/packet-socket-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -40,6 +40,14 @@
void Install (Ptr<Node> node) const;
/**
+ * Aggregate an instance of a ns3::PacketSocketFactory onto the provided
+ * node.
+ *
+ * \param nodeName The name of the node on which to aggregate the ns3::PacketSocketFactory.
+ */
+ void Install (std::string nodeName) const;
+
+ /**
* For each node in the provided container, aggregate an instance of a
* ns3::PacketSocketFactory.
*
--- a/src/helper/point-to-point-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/point-to-point-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -25,7 +25,7 @@
#include "ns3/pcap-writer.h"
#include "ns3/config.h"
#include "ns3/packet.h"
-
+#include "ns3/object-names.h"
namespace ns3 {
@@ -204,6 +204,28 @@
return container;
}
+NetDeviceContainer
+PointToPointHelper::Install (Ptr<Node> a, std::string bName)
+{
+ Ptr<Node> b = Names::Find<Node> (bName);
+ return Install (a, b);
+}
+
+NetDeviceContainer
+PointToPointHelper::Install (std::string aName, Ptr<Node> b)
+{
+ Ptr<Node> a = Names::Find<Node> (aName);
+ return Install (a, b);
+}
+
+NetDeviceContainer
+PointToPointHelper::Install (std::string aName, std::string bName)
+{
+ Ptr<Node> a = Names::Find<Node> (aName);
+ Ptr<Node> b = Names::Find<Node> (bName);
+ return Install (a, b);
+}
+
void
PointToPointHelper::InstallStar (Ptr<Node> hub, NodeContainer spokes,
NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices)
@@ -217,6 +239,14 @@
}
void
+PointToPointHelper::InstallStar (std::string hubName, NodeContainer spokes,
+ NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices)
+{
+ Ptr<Node> hub = Names::Find<Node> (hubName);
+ InstallStar (hub, spokes, hubDevices, spokeDevices);
+}
+
+void
PointToPointHelper::EnqueueEvent (Ptr<PcapWriter> writer, Ptr<const Packet> packet)
{
writer->WritePacket (packet);
--- a/src/helper/point-to-point-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/point-to-point-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -180,6 +180,30 @@
NetDeviceContainer Install (Ptr<Node> a, Ptr<Node> b);
/**
+ * \param a first node
+ * \param bName name of second node
+ *
+ * Saves you from having to construct a temporary NodeContainer.
+ */
+ NetDeviceContainer Install (Ptr<Node> a, std::string bName);
+
+ /**
+ * \param aName Name of first node
+ * \param b second node
+ *
+ * Saves you from having to construct a temporary NodeContainer.
+ */
+ NetDeviceContainer Install (std::string aName, Ptr<Node> b);
+
+ /**
+ * \param aName Name of first node
+ * \param bName Name of second node
+ *
+ * Saves you from having to construct a temporary NodeContainer.
+ */
+ NetDeviceContainer Install (std::string aNode, std::string bNode);
+
+ /**
* \brief Make a star network topology.
*
* Given a pointer to a node that will become the hub of the star, and a
@@ -207,6 +231,34 @@
void InstallStar (Ptr<Node> hub, NodeContainer spokes,
NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
+ /**
+ * \brief Make a star network topology.
+ *
+ * Given a pointer to a node that will become the hub of the star, and a
+ * NodeContainer containing pointers to the nodes that will become the
+ * spokes; we construct point to point net devices on the hub (corresponding
+ * to the spokes) and store them in the hubDevices NetDeviceContainer. We
+ * add a net device to each spoke node and store them in the spokeDevices
+ * NetDeviceContainer. A point-to-point channel is created for each spoke.
+ *
+ * The ordering of the devices in the hubDevices container is according to
+ * the order of the spokes container -- that is, hubDevices[0] will be the
+ * net device used on the hub that talks to spokes[0]. the container entry
+ * spokeDevices[0] will have the device that hubDevices[0] talks to -- those
+ * two devices are the ones that connect hub to spokes[0].
+ *
+ * \param hubName The name of the central node of the star network
+ * \param spokes A NodeContainer of the nodes that will be the spoke (leaf)
+ * nodes
+ * \param hubDevices A NetDeviceContainer that will be filled with pointers
+ * to the point-to-point net devices created on the hub.
+ * \param spokeDevices A NetDeviceContainer that will be filled with pointers
+ * to the point-to-point net devices created on each of
+ * the spokes.
+ */
+ void InstallStar (std::string hubName, NodeContainer spokes,
+ NetDeviceContainer& hubDevices, NetDeviceContainer& spokeDevices);
+
private:
void EnablePcap (Ptr<Node> node, Ptr<NetDevice> device, Ptr<Queue> queue);
void EnableAscii (Ptr<Node> node, Ptr<NetDevice> device);
--- a/src/helper/static-multicast-route-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/static-multicast-route-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -23,6 +23,7 @@
#include "ns3/assert.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4.h"
+#include "ns3/object-names.h"
#include "static-multicast-route-helper.h"
namespace ns3 {
@@ -53,6 +54,43 @@
ipv4->AddMulticastRoute (source, group, iifIndex, outputInterfaces);
}
+void
+StaticMulticastRouteHelper::AddMulticastRoute (
+ Ptr<Node> n,
+ Ipv4Address source,
+ Ipv4Address group,
+ std::string inputName,
+ NetDeviceContainer output)
+{
+ Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
+ AddMulticastRoute (n, source, group, input, output);
+}
+
+void
+StaticMulticastRouteHelper::AddMulticastRoute (
+ std::string nName,
+ Ipv4Address source,
+ Ipv4Address group,
+ Ptr<NetDevice> input,
+ NetDeviceContainer output)
+{
+ Ptr<Node> n = Names::Find<Node> (nName);
+ AddMulticastRoute (n, source, group, input, output);
+}
+
+void
+StaticMulticastRouteHelper::AddMulticastRoute (
+ std::string nName,
+ Ipv4Address source,
+ Ipv4Address group,
+ std::string inputName,
+ NetDeviceContainer output)
+{
+ Ptr<NetDevice> input = Names::Find<NetDevice> (inputName);
+ Ptr<Node> n = Names::Find<Node> (nName);
+ AddMulticastRoute (n, source, group, input, output);
+}
+
void
StaticMulticastRouteHelper::SetDefaultMulticastRoute (
Ptr<Node> n,
@@ -64,6 +102,34 @@
}
void
+StaticMulticastRouteHelper::SetDefaultMulticastRoute (
+ Ptr<Node> n,
+ std::string ndName)
+{
+ Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
+ SetDefaultMulticastRoute (n, nd);
+}
+
+void
+StaticMulticastRouteHelper::SetDefaultMulticastRoute (
+ std::string nName,
+ Ptr<NetDevice> nd)
+{
+ Ptr<Node> n = Names::Find<Node> (nName);
+ SetDefaultMulticastRoute (n, nd);
+}
+
+void
+StaticMulticastRouteHelper::SetDefaultMulticastRoute (
+ std::string nName,
+ std::string ndName)
+{
+ Ptr<Node> n = Names::Find<Node> (nName);
+ Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
+ SetDefaultMulticastRoute (n, nd);
+}
+
+void
StaticMulticastRouteHelper::JoinMulticastGroup (
Ptr<Node> n,
Ipv4Address source,
@@ -73,5 +139,15 @@
ipv4->JoinMulticastGroup (source, group);
}
+void
+StaticMulticastRouteHelper::JoinMulticastGroup (
+ std::string nName,
+ Ipv4Address source,
+ Ipv4Address group)
+{
+ Ptr<Node> n = Names::Find<Node> (nName);
+ JoinMulticastGroup (n, source, group);
+}
+
} // namespace ns3
--- a/src/helper/static-multicast-route-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/static-multicast-route-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -34,13 +34,22 @@
public:
StaticMulticastRouteHelper ();
- void AddMulticastRoute (Ptr<Node>, Ipv4Address source, Ipv4Address group,
+ void AddMulticastRoute (Ptr<Node> n, Ipv4Address source, Ipv4Address group,
+ Ptr<NetDevice> input, NetDeviceContainer output);
+ void AddMulticastRoute (std::string n, Ipv4Address source, Ipv4Address group,
Ptr<NetDevice> input, NetDeviceContainer output);
+ void AddMulticastRoute (Ptr<Node> n, Ipv4Address source, Ipv4Address group,
+ std::string inputName, NetDeviceContainer output);
+ void AddMulticastRoute (std::string nName, Ipv4Address source, Ipv4Address group,
+ std::string inputName, NetDeviceContainer output);
void SetDefaultMulticastRoute (Ptr<Node> n, Ptr<NetDevice> nd);
+ void SetDefaultMulticastRoute (Ptr<Node> n, std::string ndName);
+ void SetDefaultMulticastRoute (std::string nName, Ptr<NetDevice> nd);
+ void SetDefaultMulticastRoute (std::string nName, std::string ndName);
void JoinMulticastGroup (Ptr<Node> n, Ipv4Address source, Ipv4Address group);
-
+ void JoinMulticastGroup (std::string nName, Ipv4Address source, Ipv4Address group);
};
} // namespace ns3
--- a/src/helper/udp-echo-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/udp-echo-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -21,6 +21,7 @@
#include "ns3/udp-echo-server.h"
#include "ns3/udp-echo-client.h"
#include "ns3/uinteger.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -45,6 +46,13 @@
}
ApplicationContainer
+UdpEchoServerHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
+}
+
+ApplicationContainer
UdpEchoServerHelper::Install (NodeContainer c) const
{
ApplicationContainer apps;
@@ -87,6 +95,13 @@
}
ApplicationContainer
+UdpEchoClientHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
+}
+
+ApplicationContainer
UdpEchoClientHelper::Install (NodeContainer c) const
{
ApplicationContainer apps;
--- a/src/helper/udp-echo-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/udp-echo-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -36,6 +36,7 @@
void SetAttribute (std::string name, const AttributeValue &value);
ApplicationContainer Install (Ptr<Node> node) const;
+ ApplicationContainer Install (std::string nodeName) const;
ApplicationContainer Install (NodeContainer c) const;
private:
@@ -52,6 +53,7 @@
void SetAttribute (std::string name, const AttributeValue &value);
ApplicationContainer Install (Ptr<Node> node) const;
+ ApplicationContainer Install (std::string nodeName) const;
ApplicationContainer Install (NodeContainer c) const;
private:
--- a/src/helper/v4ping-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/v4ping-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -1,5 +1,26 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ */
+
#include "v4ping-helper.h"
#include "ns3/v4ping.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -22,6 +43,13 @@
}
ApplicationContainer
+V4PingHelper::Install (std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return ApplicationContainer (InstallPriv (node));
+}
+
+ApplicationContainer
V4PingHelper::Install (NodeContainer c) const
{
ApplicationContainer apps;
--- a/src/helper/v4ping-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/v4ping-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -16,6 +16,7 @@
ApplicationContainer Install (NodeContainer nodes) const;
ApplicationContainer Install (Ptr<Node> node) const;
+ ApplicationContainer Install (std::string nodeName) const;
private:
Ptr<Application> InstallPriv (Ptr<Node> node) const;
--- a/src/helper/wifi-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/wifi-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -31,8 +31,7 @@
#include "ns3/pcap-writer.h"
#include "ns3/config.h"
#include "ns3/simulator.h"
-
-
+#include "ns3/object-names.h"
NS_LOG_COMPONENT_DEFINE ("WifiHelper");
@@ -126,6 +125,11 @@
{
return Install (phy, NodeContainer (node));
}
-
+NetDeviceContainer
+WifiHelper::Install (const WifiPhyHelper &phy, std::string nodeName) const
+{
+ Ptr<Node> node = Names::Find<Node> (nodeName);
+ return Install (phy, NodeContainer (node));
+}
} // namespace ns3
--- a/src/helper/wifi-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/wifi-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -153,6 +153,12 @@
* \returns a device container which contains all the devices created by this method.
*/
NetDeviceContainer Install (const WifiPhyHelper &phy, Ptr<Node> node) const;
+ /**
+ * \param phy the PHY helper to create PHY objects
+ * \param nodeName the name of node on which a wifi device must be created
+ * \returns a device container which contains all the devices created by this method.
+ */
+ NetDeviceContainer Install (const WifiPhyHelper &phy, std::string nodeName) const;
private:
ObjectFactory m_stationManager;
--- a/src/helper/yans-wifi-helper.cc Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/yans-wifi-helper.cc Tue Jan 20 17:39:18 2009 -0800
@@ -27,6 +27,7 @@
#include "ns3/pcap-writer.h"
#include "ns3/simulator.h"
#include "ns3/config.h"
+#include "ns3/object-names.h"
namespace ns3 {
@@ -164,6 +165,12 @@
m_channel = channel;
}
void
+YansWifiPhyHelper::SetChannel (std::string channelName)
+{
+ Ptr<YansWifiChannel> channel = Names::Find<YansWifiChannel> (channelName);
+ m_channel = channel;
+}
+void
YansWifiPhyHelper::Set (std::string name, const AttributeValue &v)
{
m_phy.Set (name, v);
@@ -192,7 +199,6 @@
m_errorRateModel.Set (n7, v7);
}
-
Ptr<WifiPhy>
YansWifiPhyHelper::Create (Ptr<Node> node, Ptr<WifiNetDevice> device) const
{
--- a/src/helper/yans-wifi-helper.h Tue Jan 20 15:47:14 2009 -0800
+++ b/src/helper/yans-wifi-helper.h Tue Jan 20 17:39:18 2009 -0800
@@ -155,6 +155,12 @@
*/
void SetChannel (Ptr<YansWifiChannel> channel);
/**
+ * \param channelName The name of the channel to associate to this helper
+ *
+ * Every PHY created by a call to Install is associated to this channel.
+ */
+ void SetChannel (std::string channelName);
+ /**
* \param name the name of the attribute to set
* \param v the value of the attribute
*