src/helper/csma-helper.h
changeset 4140 6bbf05bf4826
parent 3848 affd0834debc
child 4263 fec2f830d015
--- 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 */