From e322d7f1df515ee0ac48a06b34fc3410e1879ada Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 10 May 2007 08:18:41 +0200 Subject: [PATCH] implement properly NetDevice::DoDispose and rename NetDevice::PeekNode to NetDevice::GetNode --- src/devices/p2p/p2p-topology.cc | 8 ++++---- src/devices/p2p/p2p-topology.h | 3 ++- src/node/net-device.cc | 13 ++++++------- src/node/net-device.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/devices/p2p/p2p-topology.cc b/src/devices/p2p/p2p-topology.cc index ff4f9e3bf..9a1daa9cf 100644 --- a/src/devices/p2p/p2p-topology.cc +++ b/src/devices/p2p/p2p-topology.cc @@ -79,13 +79,13 @@ PointToPointTopology::AddIpv4Addresses( NetDevice* nd1 = chan->GetDevice (0); NetDevice* nd2 = chan->GetDevice (1); // Make sure that nd1 belongs to n1 and nd2 to n2 - if ( (nd1->PeekNode ()->GetId () == n2->GetId () ) && - (nd2->PeekNode ()->GetId () == n1->GetId () ) ) + if ( (nd1->GetNode ()->GetId () == n2->GetId () ) && + (nd2->GetNode ()->GetId () == n1->GetId () ) ) { std::swap(nd1, nd2); } - NS_ASSERT (nd1->PeekNode ()->GetId () == n1->GetId ()); - NS_ASSERT (nd2->PeekNode ()->GetId () == n2->GetId ()); + NS_ASSERT (nd1->GetNode ()->GetId () == n1->GetId ()); + NS_ASSERT (nd2->GetNode ()->GetId () == n2->GetId ()); IIpv4 *ip1 = n1->QueryInterface (IIpv4::iid); uint32_t index1 = ip1->AddInterface (nd1); diff --git a/src/devices/p2p/p2p-topology.h b/src/devices/p2p/p2p-topology.h index ac43f1918..ecd927ff3 100644 --- a/src/devices/p2p/p2p-topology.h +++ b/src/devices/p2p/p2p-topology.h @@ -19,10 +19,11 @@ // // Topology helper for ns3. // George F. Riley, Georgia Tech, Spring 2007 -#include "ns3/ptr.h" #ifndef __POINT_TO_POINT_TOPOLOGY_H__ #define __POINT_TO_POINT_TOPOLOGY_H__ +#include "ns3/ptr.h" + // The topology class consists of only static methods thar are used to // create the topology and data flows for an ns3 simulation diff --git a/src/node/net-device.cc b/src/node/net-device.cc index 1f626d0f5..67054e03a 100644 --- a/src/node/net-device.cc +++ b/src/node/net-device.cc @@ -39,13 +39,10 @@ NetDevice::NetDevice(Ptr node, const MacAddress& addr) : m_isBroadcast (false), m_isMulticast (false), m_isPointToPoint (false) -{ -} +{} NetDevice::~NetDevice () -{ - m_node = 0; -} +{} MacAddress NetDevice::GetAddress (void) const @@ -227,7 +224,7 @@ NetDevice::NotifyLinkDown (void) } Ptr -NetDevice::PeekNode (void) const +NetDevice::GetNode (void) const { return m_node; } @@ -246,6 +243,8 @@ NetDevice::SetReceiveCallback (Callback PeekNode (void) const; + Ptr GetNode (void) const; bool NeedsArp (void) const;