}
-BridgePortNetDevice::BridgePortNetDevice(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node) : m_bridge(bridge), m_device(device){
+BridgePortNetDevice::BridgePortNetDevice(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node) : m_bridge(bridge), m_device(device), m_enabled(true){
NS_LOG_FUNCTION_NOARGS ();
if (!Mac48Address::IsMatchingType (device->GetAddress()))
NS_LOG_FUNCTION_NOARGS ();
}
+void BridgePortNetDevice::SetEnabled(bool enabled){
+ m_enabled = enabled;
+}
+
void BridgePortNetDevice::Send(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber){
NS_LOG_FUNCTION_NOARGS ();
- NS_LOG_LOGIC("SendingPacket(src=" << source << ", dest=" << dest << ")");
- m_device->SendFrom(packet->Copy(), source, dest, protocolNumber);
+ if(m_enabled){
+ NS_LOG_LOGIC("SendingPacket(src=" << source << ", dest=" << dest << ")");
+ m_device->SendFrom(packet->Copy(), source, dest, protocolNumber);
+ }
}
Ptr<NetDevice> BridgePortNetDevice::GetDevice(){
Address const &src, Address const &dst, NetDevice::PacketType packetType)
{
NS_LOG_FUNCTION_NOARGS ();
+
+ if(m_enabled){
+
NS_LOG_LOGIC ("UID is " << packet->GetUid ());
NS_LOG_LOGIC ("LearningBridgeForward (incomingPort=" << incomingPort->GetInstanceTypeId ().GetName ()
m_bridge->Forward(this, packet, protocol, src, dst, packetType);
+ }
+
}
}
virtual void Send (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber);
+ virtual void SetEnabled(bool enabled);
+
protected:
virtual void Receive (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, Address const &source, Address const &destination, NetDevice::PacketType packetType);
Ptr<BridgeNetDevice> m_bridge;
Ptr<NetDevice> m_device;
+ bool m_enabled;
};