Arp -> ArpL3Protocol
This commit is contained in:
@@ -30,22 +30,22 @@
|
||||
#include "ipv4-interface.h"
|
||||
#include "i-ipv4-private.h"
|
||||
|
||||
NS_DEBUG_COMPONENT_DEFINE ("Arp");
|
||||
NS_DEBUG_COMPONENT_DEFINE ("ArpL3Protocol");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
const uint16_t Arp::PROT_NUMBER = 0x0806;
|
||||
const uint16_t ArpL3Protocol::PROT_NUMBER = 0x0806;
|
||||
|
||||
Arp::Arp (Ptr<Node> node)
|
||||
ArpL3Protocol::ArpL3Protocol (Ptr<Node> node)
|
||||
: L3Protocol (PROT_NUMBER, 0/* XXX: correct version number ? */ ),
|
||||
m_node (node)
|
||||
{}
|
||||
|
||||
Arp::~Arp ()
|
||||
ArpL3Protocol::~ArpL3Protocol ()
|
||||
{}
|
||||
|
||||
void
|
||||
Arp::DoDispose (void)
|
||||
ArpL3Protocol::DoDispose (void)
|
||||
{
|
||||
for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++)
|
||||
{
|
||||
@@ -57,13 +57,13 @@ Arp::DoDispose (void)
|
||||
}
|
||||
|
||||
TraceResolver *
|
||||
Arp::CreateTraceResolver (TraceContext const &context)
|
||||
ArpL3Protocol::CreateTraceResolver (TraceContext const &context)
|
||||
{
|
||||
return new EmptyTraceResolver (context);
|
||||
}
|
||||
|
||||
ArpCache *
|
||||
Arp::FindCache (Ptr<NetDevice> device)
|
||||
ArpL3Protocol::FindCache (Ptr<NetDevice> device)
|
||||
{
|
||||
for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ Arp::FindCache (Ptr<NetDevice> device)
|
||||
}
|
||||
|
||||
void
|
||||
Arp::Receive(Packet& packet, Ptr<NetDevice> device)
|
||||
ArpL3Protocol::Receive(Packet& packet, Ptr<NetDevice> device)
|
||||
{
|
||||
ArpCache *cache = FindCache (device);
|
||||
ArpHeader arp;
|
||||
@@ -130,7 +130,7 @@ Arp::Receive(Packet& packet, Ptr<NetDevice> device)
|
||||
}
|
||||
}
|
||||
bool
|
||||
Arp::Lookup (Packet &packet, Ipv4Address destination,
|
||||
ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination,
|
||||
Ptr<NetDevice> device,
|
||||
MacAddress *hardwareDestination)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ Arp::Lookup (Packet &packet, Ipv4Address destination,
|
||||
}
|
||||
|
||||
void
|
||||
Arp::SendArpRequest (ArpCache const *cache, Ipv4Address to)
|
||||
ArpL3Protocol::SendArpRequest (ArpCache const *cache, Ipv4Address to)
|
||||
{
|
||||
ArpHeader arp;
|
||||
arp.SetRequest (cache->GetDevice ()->GetAddress (),
|
||||
@@ -213,7 +213,7 @@ Arp::SendArpRequest (ArpCache const *cache, Ipv4Address to)
|
||||
}
|
||||
|
||||
void
|
||||
Arp::SendArpReply (ArpCache const *cache, Ipv4Address toIp, MacAddress toMac)
|
||||
ArpL3Protocol::SendArpReply (ArpCache const *cache, Ipv4Address toIp, MacAddress toMac)
|
||||
{
|
||||
ArpHeader arp;
|
||||
arp.SetReply (cache->GetDevice ()->GetAddress (),
|
||||
|
||||
@@ -38,7 +38,7 @@ class TraceContext;
|
||||
/**
|
||||
* \brief An implementation of the ARP protocol
|
||||
*/
|
||||
class Arp : public L3Protocol
|
||||
class ArpL3Protocol : public L3Protocol
|
||||
{
|
||||
public:
|
||||
static const uint16_t PROT_NUMBER;
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
* \brief Constructor
|
||||
* \param node The node which this ARP object is associated with
|
||||
*/
|
||||
Arp (Ptr<Node> node);
|
||||
~Arp ();
|
||||
ArpL3Protocol (Ptr<Node> node);
|
||||
~ArpL3Protocol ();
|
||||
|
||||
virtual TraceResolver *CreateTraceResolver (TraceContext const &context);
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace ns3 {
|
||||
|
||||
const InterfaceId IArpPrivate::iid = MakeInterfaceId ("IArpPrivate", Object::iid);
|
||||
|
||||
IArpPrivate::IArpPrivate (Ptr<Arp> arp)
|
||||
IArpPrivate::IArpPrivate (Ptr<ArpL3Protocol> arp)
|
||||
: m_arp (arp)
|
||||
{
|
||||
SetInterfaceId (IArpPrivate::iid);
|
||||
|
||||
@@ -29,13 +29,13 @@ namespace ns3 {
|
||||
class NetDevice;
|
||||
class MacAddress;
|
||||
class Packet;
|
||||
class Arp;
|
||||
class ArpL3Protocol;
|
||||
|
||||
class IArpPrivate : public Object
|
||||
{
|
||||
public:
|
||||
static const InterfaceId iid;
|
||||
IArpPrivate (Ptr<Arp> arp);
|
||||
IArpPrivate (Ptr<ArpL3Protocol> arp);
|
||||
virtual ~IArpPrivate ();
|
||||
bool Lookup (Packet &p, Ipv4Address destination,
|
||||
Ptr<NetDevice> device,
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
private:
|
||||
Ptr<Arp> m_arp;
|
||||
Ptr<ArpL3Protocol> m_arp;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -55,7 +55,7 @@ void
|
||||
InternetNode::Construct (void)
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = Create<Ipv4L3Protocol> (this);
|
||||
Ptr<Arp> arp = Create<Arp> (this);
|
||||
Ptr<ArpL3Protocol> arp = Create<ArpL3Protocol> (this);
|
||||
Ptr<Udp> udp = Create<Udp> (this);
|
||||
|
||||
Ptr<L3Demux> l3Demux = Create<L3Demux> (this);
|
||||
|
||||
Reference in New Issue
Block a user