m_deviceFactory.Set (n1, v1);
}
+NetDeviceContainer
+BridgeHelper::Install (Ptr<Node> node, NetDeviceContainer c, std::map<Ptr<NetDevice>, bool> portsEnabled)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_LOGIC ("**** Install bridge device on node " << node->GetId ());
+
+ NetDeviceContainer devs;
+ Ptr<BridgeNetDevice> dev = m_deviceFactory.Create<BridgeNetDevice> ();
+ devs.Add (dev);
+ node->AddDevice (dev);
+
+ for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
+ {
+ NS_LOG_LOGIC ("**** Add BridgePort "<< *i);
+ Ptr<BridgePortNetDevice> port = dev->AddBridgePort (*i);
+ if(portsEnabled.find(*i) != portsEnabled.end()){
+ port->SetEnabled(portsEnabled[*i]);
+ }
+ }
+ return devs;
+}
+
+
NetDeviceContainer
BridgeHelper::Install (Ptr<Node> node, NetDeviceContainer c)
{
#include "ns3/net-device-container.h"
#include "ns3/object-factory.h"
#include <string>
+#include <map>
namespace ns3 {
* \param v1 the value of the attribute to set
*/
void SetDeviceAttribute (std::string n1, const AttributeValue &v1);
+
+ /**
+ * This method creates an ns3::BridgeNetDevice with the attributes
+ * configured by BridgeHelper::SetDeviceAttribute, adds the device
+ * to the node, and attaches the given NetDevices as ports of the
+ * bridge.
+ *
+ * This version uses static spanning tree to disable loops.
+ *
+ * \param node The node to install the device in
+ * \param c Container of NetDevices to add as bridge ports
+ * \returns A container holding the added net device.
+ */
+ NetDeviceContainer Install (Ptr<Node> node, NetDeviceContainer c, std::map<Ptr<NetDevice>, bool> portsEnabled);
+
/**
* This method creates an ns3::BridgeNetDevice with the attributes
* configured by BridgeHelper::SetDeviceAttribute, adds the device