diff --git a/src/devices/bridge/bridge-channel.cc b/src/devices/bridge/bridge-channel.cc index e5eac7a54..b8b8b6bca 100644 --- a/src/devices/bridge/bridge-channel.cc +++ b/src/devices/bridge/bridge-channel.cc @@ -34,7 +34,7 @@ BridgeChannel::GetTypeId (void) } BridgeChannel::BridgeChannel () - : Channel ("BridgeChannel") + : Channel () { NS_LOG_FUNCTION_NOARGS (); } diff --git a/src/devices/bridge/bridge-net-device.cc b/src/devices/bridge/bridge-net-device.cc index b4a376b8c..03d7778eb 100644 --- a/src/devices/bridge/bridge-net-device.cc +++ b/src/devices/bridge/bridge-net-device.cc @@ -53,7 +53,6 @@ BridgeNetDevice::GetTypeId (void) BridgeNetDevice::BridgeNetDevice () : m_node (0), - m_name (""), m_ifIndex (0), m_mtu (0xffff) { @@ -128,7 +127,7 @@ BridgeNetDevice::ForwardUnicast (Ptr incomingPort, Ptr uint16_t protocol, Mac48Address src, Mac48Address dst) { NS_LOG_FUNCTION_NOARGS (); - NS_LOG_DEBUG ("LearningBridgeForward (incomingPort=" << incomingPort->GetName () + NS_LOG_DEBUG ("LearningBridgeForward (incomingPort=" << incomingPort->GetInstanceTypeId ().GetName () << ", packet=" << packet << ", protocol="< incomingPort, Ptr Ptr outPort = GetLearnedState (dst); if (outPort != NULL && outPort != incomingPort) { - NS_LOG_LOGIC ("Learning bridge state says to use port `" << outPort->GetName () << "'"); + NS_LOG_LOGIC ("Learning bridge state says to use port `" << outPort->GetInstanceTypeId ().GetName () << "'"); outPort->SendFrom (packet->Copy (), src, dst, protocol); } else @@ -148,8 +147,9 @@ BridgeNetDevice::ForwardUnicast (Ptr incomingPort, Ptr Ptr port = *iter; if (port != incomingPort) { - NS_LOG_LOGIC ("LearningBridgeForward (" << src << " => " << dst << "): " << incomingPort->GetName () - << " --> " << port->GetName () + NS_LOG_LOGIC ("LearningBridgeForward (" << src << " => " << dst << "): " + << incomingPort->GetInstanceTypeId ().GetName () + << " --> " << port->GetInstanceTypeId ().GetName () << " (UID " << packet->GetUid () << ")."); port->SendFrom (packet->Copy (), src, dst, protocol); } @@ -162,7 +162,7 @@ BridgeNetDevice::ForwardBroadcast (Ptr incomingPort, Ptr incomingPort, Ptr port = *iter; if (port != incomingPort) { - NS_LOG_LOGIC ("LearningBridgeForward (" << src << " => " << dst << "): " << incomingPort->GetName () - << " --> " << port->GetName () + NS_LOG_LOGIC ("LearningBridgeForward (" << src << " => " << dst << "): " + << incomingPort->GetInstanceTypeId ().GetName () + << " --> " << port->GetInstanceTypeId ().GetName () << " (UID " << packet->GetUid () << ")."); port->SendFrom (packet->Copy (), src, dst, protocol); } @@ -249,27 +250,13 @@ BridgeNetDevice::AddBridgePort (Ptr bridgePort) m_address = Mac48Address::ConvertFrom (bridgePort->GetAddress ()); } - NS_LOG_DEBUG ("RegisterProtocolHandler for " << bridgePort->GetName ()); + NS_LOG_DEBUG ("RegisterProtocolHandler for " << bridgePort->GetInstanceTypeId ().GetName ()); m_node->RegisterProtocolHandler (MakeCallback (&BridgeNetDevice::ReceiveFromDevice, this), 0, bridgePort, true); m_ports.push_back (bridgePort); m_channel->AddChannel (bridgePort->GetChannel ()); } -void -BridgeNetDevice::SetName(const std::string name) -{ - NS_LOG_FUNCTION_NOARGS (); - m_name = name; -} - -std::string -BridgeNetDevice::GetName(void) const -{ - NS_LOG_FUNCTION_NOARGS (); - return m_name; -} - void BridgeNetDevice::SetIfIndex(const uint32_t index) { diff --git a/src/devices/bridge/bridge-net-device.h b/src/devices/bridge/bridge-net-device.h index 4af590c97..02be49f37 100644 --- a/src/devices/bridge/bridge-net-device.h +++ b/src/devices/bridge/bridge-net-device.h @@ -88,8 +88,6 @@ public: Ptr GetBridgePort (uint32_t n) const; // inherited from NetDevice base class. - virtual void SetName(const std::string name); - virtual std::string GetName(void) const; virtual void SetIfIndex(const uint32_t index); virtual uint32_t GetIfIndex(void) const; virtual Ptr GetChannel (void) const; @@ -140,7 +138,6 @@ private: std::map m_learnState; Ptr m_node; Ptr m_channel; - std::string m_name; std::vector< Ptr > m_ports; uint32_t m_ifIndex; uint16_t m_mtu; diff --git a/src/devices/csma/csma-channel.cc b/src/devices/csma/csma-channel.cc index ab2a83bf3..20b870db1 100644 --- a/src/devices/csma/csma-channel.cc +++ b/src/devices/csma/csma-channel.cc @@ -51,7 +51,7 @@ CsmaChannel::GetTypeId (void) CsmaChannel::CsmaChannel () : - Channel ("Csma Channel") + Channel () { NS_LOG_FUNCTION_NOARGS (); m_state = IDLE; diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index f9742c649..dc953e7b6 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -154,8 +154,7 @@ CsmaNetDevice::GetTypeId (void) } CsmaNetDevice::CsmaNetDevice () - : m_name (""), - m_linkUp (false) + : m_linkUp (false) { NS_LOG_FUNCTION (this); m_txMachineState = READY; @@ -873,20 +872,6 @@ CsmaNetDevice::NotifyLinkUp (void) } } - void -CsmaNetDevice::SetName (const std::string name) -{ - NS_LOG_FUNCTION (name); - m_name = name; -} - - std::string -CsmaNetDevice::GetName (void) const -{ - NS_LOG_FUNCTION_NOARGS (); - return m_name; -} - void CsmaNetDevice::SetIfIndex (const uint32_t index) { @@ -1054,25 +1039,6 @@ CsmaNetDevice::SetNode (Ptr node) NS_LOG_FUNCTION (node); m_node = node; - int count = -1; - if (m_name.size () == 0) - { - for (uint32_t i = 0; i < node->GetNDevices (); i++) - { - Ptr dev = node->GetDevice (i); - if (dynamic_cast (PeekPointer (dev))) - { - count++; - if (dev == this) - { - break; - } - } - } - std::ostringstream s; - s << "eth" << count; - m_name = s.str (); - } } bool diff --git a/src/devices/csma/csma-net-device.h b/src/devices/csma/csma-net-device.h index 2213e1390..7dc1f9c55 100644 --- a/src/devices/csma/csma-net-device.h +++ b/src/devices/csma/csma-net-device.h @@ -305,8 +305,6 @@ public: // // The following methods are inherited from NetDevice base class. // - virtual void SetName (const std::string name); - virtual std::string GetName (void) const; virtual void SetIfIndex (const uint32_t index); virtual uint32_t GetIfIndex (void) const; virtual Ptr GetChannel (void) const; @@ -807,11 +805,6 @@ private: */ uint32_t m_ifIndex; - /** - * The human readable name of this device. - */ - std::string m_name; - /** * Flag indicating whether or not the link is up. In this case, * whether or not the device is connected to a channel. diff --git a/src/devices/emu/emu-net-device.cc b/src/devices/emu/emu-net-device.cc index 0a987850e..7d3e451eb 100644 --- a/src/devices/emu/emu-net-device.cc +++ b/src/devices/emu/emu-net-device.cc @@ -68,11 +68,6 @@ EmuNetDevice::GetTypeId (void) Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")), MakeMac48AddressAccessor (&EmuNetDevice::m_address), MakeMac48AddressChecker ()) - .AddAttribute ("DeviceName", - "The name of the underlying real device (e.g. eth1).", - StringValue ("eth1"), - MakeStringAccessor (&EmuNetDevice::m_deviceName), - MakeStringChecker ()) .AddAttribute ("Start", "The simulation time at which to spin up the device thread.", TimeValue (Seconds (0.)), @@ -173,8 +168,7 @@ EmuNetDevice::EmuNetDevice () m_sock (-1), m_readThread (0), m_ifIndex (std::numeric_limits::max ()), // absurdly large value - m_sll_ifindex (-1), - m_name ("Emu NetDevice") + m_sll_ifindex (-1) { NS_LOG_FUNCTION (this); Start (m_tStart); @@ -843,18 +837,6 @@ EmuNetDevice::NotifyLinkUp (void) } } -void -EmuNetDevice::SetName(const std::string name) -{ - m_name = name; -} - -std::string -EmuNetDevice::GetName(void) const -{ - return m_name; -} - void EmuNetDevice::SetIfIndex(const uint32_t index) { diff --git a/src/devices/emu/emu-net-device.h b/src/devices/emu/emu-net-device.h index 02947cb53..189a81833 100644 --- a/src/devices/emu/emu-net-device.h +++ b/src/devices/emu/emu-net-device.h @@ -105,9 +105,6 @@ public: // // Pure virtual methods inherited from NetDevice we must implement. // - virtual void SetName(const std::string name); - virtual std::string GetName(void) const; - virtual void SetIfIndex(const uint32_t index); virtual uint32_t GetIfIndex(void) const; @@ -449,11 +446,6 @@ private: */ int32_t m_sll_ifindex; - /** - * The human readable name of this device. - */ - std::string m_name; - /** * Flag indicating whether or not the link is up. In this case, * whether or not the device is connected to a channel. diff --git a/src/devices/point-to-point/point-to-point-channel.cc b/src/devices/point-to-point/point-to-point-channel.cc index b94add35c..6fa1b7bee 100644 --- a/src/devices/point-to-point/point-to-point-channel.cc +++ b/src/devices/point-to-point/point-to-point-channel.cc @@ -43,11 +43,11 @@ PointToPointChannel::GetTypeId (void) } // -// By default, you get a channel with the name "PointToPoint Channel" that +// By default, you get a channel that // has an "infitely" fast transmission speed and zero delay. PointToPointChannel::PointToPointChannel() : - Channel ("PointToPoint Channel"), + Channel (), m_delay (Seconds (0.)), m_nDevices (0) { diff --git a/src/devices/point-to-point/point-to-point-channel.h b/src/devices/point-to-point/point-to-point-channel.h index b31a37ae7..9830e048f 100644 --- a/src/devices/point-to-point/point-to-point-channel.h +++ b/src/devices/point-to-point/point-to-point-channel.h @@ -50,7 +50,7 @@ public: /** * \brief Create a PointToPointChannel * - * By default, you get a channel with the name "PointToPoint Channel" that + * By default, you get a channel that * has zero transmission delay. */ PointToPointChannel (); diff --git a/src/devices/point-to-point/point-to-point-net-device.cc b/src/devices/point-to-point/point-to-point-net-device.cc index 856ba6852..609441cad 100644 --- a/src/devices/point-to-point/point-to-point-net-device.cc +++ b/src/devices/point-to-point/point-to-point-net-device.cc @@ -148,7 +148,6 @@ PointToPointNetDevice::PointToPointNetDevice () : m_txMachineState (READY), m_channel (0), - m_name (""), m_linkUp (false), m_currentPkt (0) { @@ -373,18 +372,6 @@ PointToPointNetDevice::NotifyLinkUp (void) } } - void -PointToPointNetDevice::SetName(const std::string name) -{ - m_name = name; -} - - std::string -PointToPointNetDevice::GetName(void) const -{ - return m_name; -} - void PointToPointNetDevice::SetIfIndex(const uint32_t index) { diff --git a/src/devices/point-to-point/point-to-point-net-device.h b/src/devices/point-to-point/point-to-point-net-device.h index 5af6c9c66..956b6a356 100644 --- a/src/devices/point-to-point/point-to-point-net-device.h +++ b/src/devices/point-to-point/point-to-point-net-device.h @@ -226,12 +226,6 @@ public: */ uint16_t GetFrameSize (void) const; -// -// Pure virtual methods inherited from NetDevice we must implement. -// - virtual void SetName(const std::string name); - virtual std::string GetName(void) const; - virtual void SetIfIndex(const uint32_t index); virtual uint32_t GetIfIndex(void) const; @@ -531,7 +525,6 @@ private: NetDevice::ReceiveCallback m_rxCallback; NetDevice::PromiscReceiveCallback m_promiscCallback; uint32_t m_ifIndex; - std::string m_name; bool m_linkUp; Callback m_linkChangeCallback; diff --git a/src/devices/tap-bridge/tap-bridge.cc b/src/devices/tap-bridge/tap-bridge.cc index fa14796a9..9c99c21fb 100644 --- a/src/devices/tap-bridge/tap-bridge.cc +++ b/src/devices/tap-bridge/tap-bridge.cc @@ -957,20 +957,6 @@ TapBridge::ReceiveFromBridgedDevice ( NS_ABORT_MSG_IF (bytesWritten != p->GetSize (), "TapBridge::ReceiveFromBridgedDevice(): Write error."); } -void -TapBridge::SetName(const std::string name) -{ - NS_LOG_FUNCTION_NOARGS (); - m_name = name; -} - -std::string -TapBridge::GetName(void) const -{ - NS_LOG_FUNCTION_NOARGS (); - return m_name; -} - void TapBridge::SetIfIndex(const uint32_t index) { diff --git a/src/devices/tap-bridge/tap-bridge.h b/src/devices/tap-bridge/tap-bridge.h index 62d6a1350..ac2fb2a2d 100644 --- a/src/devices/tap-bridge/tap-bridge.h +++ b/src/devices/tap-bridge/tap-bridge.h @@ -173,8 +173,6 @@ public: // The following methods are inherited from NetDevice base class and are // documented there. // - virtual void SetName(const std::string name); - virtual std::string GetName(void) const; virtual void SetIfIndex(const uint32_t index); virtual uint32_t GetIfIndex(void) const; virtual Ptr GetChannel (void) const; @@ -318,12 +316,6 @@ private: */ Ptr m_node; - /** - * \internal - * - * A possible name for the (ghost) Node to which we are connected. - */ - std::string m_name; /** * \internal diff --git a/src/devices/wifi/wifi-net-device.cc b/src/devices/wifi/wifi-net-device.cc index 5f67c2224..d7dccc85d 100644 --- a/src/devices/wifi/wifi-net-device.cc +++ b/src/devices/wifi/wifi-net-device.cc @@ -136,16 +136,6 @@ WifiNetDevice::GetRemoteStationManager (void) const return m_stationManager; } -void -WifiNetDevice::SetName(const std::string name) -{ - m_name = name; -} -std::string -WifiNetDevice::GetName(void) const -{ - return m_name; -} void WifiNetDevice::SetIfIndex(const uint32_t index) { diff --git a/src/devices/wifi/wifi-net-device.h b/src/devices/wifi/wifi-net-device.h index 2bee1d2f9..d5aae5797 100644 --- a/src/devices/wifi/wifi-net-device.h +++ b/src/devices/wifi/wifi-net-device.h @@ -75,8 +75,6 @@ public: // inherited from NetDevice base class. - virtual void SetName(const std::string name); - virtual std::string GetName(void) const; virtual void SetIfIndex(const uint32_t index); virtual uint32_t GetIfIndex(void) const; virtual Ptr GetChannel (void) const; @@ -123,7 +121,6 @@ private: TracedCallback, Mac48Address> m_txLogger; uint32_t m_ifIndex; - std::string m_name; bool m_linkUp; Callback m_linkChange; mutable uint16_t m_mtu; diff --git a/src/node/channel.cc b/src/node/channel.cc index 6f23bad49..e85503c66 100644 --- a/src/node/channel.cc +++ b/src/node/channel.cc @@ -35,34 +35,14 @@ Channel::GetTypeId (void) } Channel::Channel () - : m_name("Channel") { NS_LOG_FUNCTION_NOARGS (); } -Channel::Channel (std::string name) - : m_name(name) -{ - NS_LOG_FUNCTION (this << name); -} Channel::~Channel () { NS_LOG_FUNCTION_NOARGS (); } - void -Channel::SetName(std::string name) -{ - NS_LOG_FUNCTION (this << name); - m_name = name; -} - - std::string -Channel::GetName(void) -{ - NS_LOG_FUNCTION_NOARGS (); - return m_name; -} - } // namespace ns3 diff --git a/src/node/channel.h b/src/node/channel.h index 1e4a0cd6a..68f8d3175 100644 --- a/src/node/channel.h +++ b/src/node/channel.h @@ -43,12 +43,8 @@ public: static TypeId GetTypeId (void); Channel (); - Channel (std::string name); virtual ~Channel (); - void SetName(std::string); - std::string GetName(void); - /** * \returns the number of NetDevices connected to this Channel. * @@ -63,10 +59,8 @@ public: */ virtual Ptr GetDevice (uint32_t i) const = 0; -private: - std::string m_name; }; -}; // namespace ns3 +} // namespace ns3 #endif /* NS3_CHANNEL_H */ diff --git a/src/node/net-device.h b/src/node/net-device.h index ced6c9dff..dcdaa6d75 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -67,14 +67,6 @@ public: static TypeId GetTypeId (void); virtual ~NetDevice(); - /** - * \param name name of the device (e.g. "eth0") - */ - virtual void SetName(const std::string name) = 0; - /** - * \return name name of the device (e.g. "eth0") - */ - virtual std::string GetName(void) const = 0; /** * \param index ifIndex of the device */ diff --git a/src/node/node.cc b/src/node/node.cc index 9cecbab14..199490484 100644 --- a/src/node/node.cc +++ b/src/node/node.cc @@ -225,7 +225,7 @@ bool Node::PromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType) { - NS_LOG_FUNCTION(device->GetName ()); + NS_LOG_FUNCTION(this); return ReceiveFromDevice (device, packet, protocol, from, to, packetType, true); } @@ -233,7 +233,7 @@ bool Node::NonPromiscReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, const Address &from) { - NS_LOG_FUNCTION(device->GetName ()); + NS_LOG_FUNCTION(this); return ReceiveFromDevice (device, packet, protocol, from, from, NetDevice::PacketType (0), false); } @@ -242,8 +242,7 @@ Node::ReceiveFromDevice (Ptr device, Ptr packet, uint16 const Address &from, const Address &to, NetDevice::PacketType packetType, bool promiscuous) { NS_LOG_DEBUG("Node " << GetId () << " ReceiveFromDevice: dev " - << device->GetIfIndex () << " (" - << device->GetName () << " type " << device->GetInstanceTypeId ().GetName () + << device->GetIfIndex () << " (type=" << device->GetInstanceTypeId ().GetName () << ") Packet UID " << packet->GetUid ()); bool found = false; diff --git a/src/node/simple-net-device.cc b/src/node/simple-net-device.cc index d13bd53fe..d996d5341 100644 --- a/src/node/simple-net-device.cc +++ b/src/node/simple-net-device.cc @@ -38,7 +38,6 @@ SimpleNetDevice::SimpleNetDevice () : m_channel (0), m_node (0), m_mtu (0xffff), - m_name (""), m_ifIndex (0) {} @@ -83,16 +82,6 @@ SimpleNetDevice::SetAddress (Mac48Address address) m_address = address; } -void -SimpleNetDevice::SetName(const std::string name) -{ - m_name = name; -} -std::string -SimpleNetDevice::GetName(void) const -{ - return m_name; -} void SimpleNetDevice::SetIfIndex(const uint32_t index) { diff --git a/src/node/simple-net-device.h b/src/node/simple-net-device.h index 1e1f15323..7840887cf 100644 --- a/src/node/simple-net-device.h +++ b/src/node/simple-net-device.h @@ -46,8 +46,6 @@ public: void SetAddress (Mac48Address address); // inherited from NetDevice base class. - virtual void SetName(const std::string name); - virtual std::string GetName(void) const; virtual void SetIfIndex(const uint32_t index); virtual uint32_t GetIfIndex(void) const; virtual Ptr GetChannel (void) const; @@ -82,7 +80,6 @@ private: NetDevice::PromiscReceiveCallback m_promiscCallback; Ptr m_node; uint16_t m_mtu; - std::string m_name; uint32_t m_ifIndex; Mac48Address m_address; };