diff --git a/src/internet-node/arp-ipv4-interface.cc b/src/internet-node/arp-ipv4-interface.cc index d5a9105fe..313bb5851 100644 --- a/src/internet-node/arp-ipv4-interface.cc +++ b/src/internet-node/arp-ipv4-interface.cc @@ -28,8 +28,8 @@ #include "ns3/address.h" #include "arp-ipv4-interface.h" -#include "arp-private.h" #include "ipv4-l3-protocol.h" +#include "arp-l3-protocol.h" namespace ns3 { @@ -60,18 +60,17 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest) NS_ASSERT (GetDevice () != 0); if (GetDevice ()->NeedsArp ()) { - Ptr arp = m_node->QueryInterface (ArpPrivate::iid); + Ptr arp = m_node->QueryInterface (ArpL3Protocol::iid); Address hardwareDestination; bool found; if (dest.IsBroadcast ()) { - hardwareDestination = GetDevice ()->GetBroadcast (); - found = true; + hardwareDestination = GetDevice ()->GetBroadcast (); + found = true; } else { - Ptr arp = m_node->QueryInterface (ArpPrivate::iid); found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination); } diff --git a/src/internet-node/arp-l3-protocol.cc b/src/internet-node/arp-l3-protocol.cc index 1e2d7030f..130f3a1b4 100644 --- a/src/internet-node/arp-l3-protocol.cc +++ b/src/internet-node/arp-l3-protocol.cc @@ -34,6 +34,7 @@ NS_DEBUG_COMPONENT_DEFINE ("ArpL3Protocol"); namespace ns3 { +const InterfaceId ArpL3Protocol::iid = MakeInterfaceId ("ArpL3Protocol", Object::iid); const uint16_t ArpL3Protocol::PROT_NUMBER = 0x0806; ArpL3Protocol::ArpL3Protocol (Ptr node) diff --git a/src/internet-node/arp-l3-protocol.h b/src/internet-node/arp-l3-protocol.h index ea61ec8af..d3ae7441d 100644 --- a/src/internet-node/arp-l3-protocol.h +++ b/src/internet-node/arp-l3-protocol.h @@ -40,6 +40,7 @@ class TraceContext; class ArpL3Protocol : public Object { public: + static const InterfaceId iid; static const uint16_t PROT_NUMBER; /** * \brief Constructor diff --git a/src/internet-node/arp-private.cc b/src/internet-node/arp-private.cc deleted file mode 100644 index 4f60dac99..000000000 --- a/src/internet-node/arp-private.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Mathieu Lacage - */ -#include "arp-private.h" -#include "arp-l3-protocol.h" -#include "ns3/assert.h" -#include "ns3/net-device.h" - -namespace ns3 { - -const InterfaceId ArpPrivate::iid = MakeInterfaceId ("ArpPrivate", Object::iid); - -ArpPrivate::ArpPrivate (Ptr arp) - : m_arp (arp) -{ - SetInterfaceId (ArpPrivate::iid); -} -ArpPrivate::~ArpPrivate () -{ - NS_ASSERT (m_arp == 0); -} - -bool -ArpPrivate::Lookup (Packet &p, Ipv4Address destination, - Ptr device, - Address *hardwareDestination) -{ - return m_arp->Lookup (p, destination, device, hardwareDestination); -} - -void -ArpPrivate::DoDispose (void) -{ - m_arp = 0; - Object::DoDispose (); -} - - -} // namespace ns3 diff --git a/src/internet-node/arp-private.h b/src/internet-node/arp-private.h deleted file mode 100644 index af0b8b7a3..000000000 --- a/src/internet-node/arp-private.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2007 INRIA - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Mathieu Lacage - */ -#ifndef ARP_PRIVATE_H -#define ARP_PRIVATE_H - -#include "ns3/object.h" -#include "ns3/ipv4-address.h" - -namespace ns3 { - -class NetDevice; -class Address; -class Packet; -class ArpL3Protocol; - -class ArpPrivate : public Object -{ -public: - static const InterfaceId iid; - ArpPrivate (Ptr arp); - virtual ~ArpPrivate (); - bool Lookup (Packet &p, Ipv4Address destination, - Ptr device, - Address *hardwareDestination); -protected: - virtual void DoDispose (void); -private: - Ptr m_arp; -}; - -} // namespace ns3 - -#endif /* ARP_PRIVATE_H */ diff --git a/src/internet-node/internet-node.cc b/src/internet-node/internet-node.cc index 128a3f332..fa0bb1471 100644 --- a/src/internet-node/internet-node.cc +++ b/src/internet-node/internet-node.cc @@ -31,7 +31,6 @@ #include "ipv4-l3-protocol.h" #include "arp-l3-protocol.h" #include "udp-impl.h" -#include "arp-private.h" #include "ipv4-impl.h" namespace ns3 { @@ -67,12 +66,11 @@ InternetNode::Construct (void) ipv4L4Demux->Insert (udp); Ptr udpImpl = Create (udp); - Ptr arpPrivate = Create (arp); Ptr ipv4Impl = Create (ipv4); Object::AddInterface (ipv4); + Object::AddInterface (arp); Object::AddInterface (ipv4Impl); - Object::AddInterface (arpPrivate); Object::AddInterface (udpImpl); Object::AddInterface (ipv4L4Demux); } diff --git a/src/internet-node/wscript b/src/internet-node/wscript index b94277456..e0af13434 100644 --- a/src/internet-node/wscript +++ b/src/internet-node/wscript @@ -25,7 +25,6 @@ def build(bld): 'ipv4-loopback-interface.cc', 'udp-socket.cc', 'ipv4-end-point-demux.cc', - 'arp-private.cc', 'ipv4-impl.cc', 'ascii-trace.cc', 'pcap-trace.cc',