revert Ipv4Interface * -> Ptr<Ipv4Interface>
parent
90a0cb3ad2
commit
c12d5a1142
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace ns3 {
|
||||
|
||||
ArpCache::ArpCache (NetDevice *device, Ptr<Ipv4Interface> interface)
|
||||
ArpCache::ArpCache (NetDevice *device, Ipv4Interface *interface)
|
||||
: m_device (device),
|
||||
m_interface (interface),
|
||||
m_aliveTimeout (Seconds (120)),
|
||||
|
@ -50,7 +50,7 @@ ArpCache::PeekDevice (void) const
|
|||
return m_device;
|
||||
}
|
||||
|
||||
Ptr<Ipv4Interface>
|
||||
Ipv4Interface *
|
||||
ArpCache::GetInterface (void) const
|
||||
{
|
||||
return m_interface;
|
||||
|
|
|
@ -28,22 +28,21 @@
|
|||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/mac-address.h"
|
||||
#include "sgi-hashmap.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ipv4-interface.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class NetDevice;
|
||||
class Ipv4Interface;
|
||||
|
||||
class ArpCache {
|
||||
public:
|
||||
class Entry;
|
||||
|
||||
ArpCache (NetDevice *device, Ptr<Ipv4Interface> interface);
|
||||
ArpCache (NetDevice *device, Ipv4Interface *interface);
|
||||
~ArpCache ();
|
||||
|
||||
NetDevice *PeekDevice (void) const;
|
||||
Ptr<Ipv4Interface> GetInterface (void) const;
|
||||
Ipv4Interface *GetInterface (void) const;
|
||||
|
||||
void SetAliveTimeout (Time aliveTimeout);
|
||||
void SetDeadTimeout (Time deadTimeout);
|
||||
|
@ -93,7 +92,7 @@ private:
|
|||
typedef sgi::hash_map<Ipv4Address, ArpCache::Entry *, Ipv4AddressHash>::iterator CacheI;
|
||||
|
||||
NetDevice *m_device;
|
||||
Ptr<Ipv4Interface> m_interface;
|
||||
Ipv4Interface *m_interface;
|
||||
Time m_aliveTimeout;
|
||||
Time m_deadTimeout;
|
||||
Time m_waitReplyTimeout;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "ns3/empty-trace-resolver.h"
|
||||
#include "ns3/node.h"
|
||||
#include "ns3/net-device.h"
|
||||
#include "ns3/ptr.h"
|
||||
|
||||
#include "arp.h"
|
||||
#include "arp-header.h"
|
||||
|
@ -37,10 +36,11 @@ namespace ns3 {
|
|||
|
||||
const uint16_t Arp::PROT_NUMBER = 0x0806;
|
||||
|
||||
Arp::Arp (Ptr<Node> node)
|
||||
Arp::Arp (Node *node)
|
||||
: L3Protocol (PROT_NUMBER, 0/* XXX: correct version number ? */ ),
|
||||
m_node (node)
|
||||
{
|
||||
m_node->Ref ();
|
||||
}
|
||||
|
||||
Arp::~Arp ()
|
||||
|
@ -81,7 +81,7 @@ Arp::FindCache (NetDevice *device)
|
|||
}
|
||||
}
|
||||
IIpv4Private *ipv4 = m_node->QueryInterface<IIpv4Private> (IIpv4Private::iid);
|
||||
Ptr<Ipv4Interface> interface = ipv4->FindInterfaceForDevice (device);
|
||||
Ipv4Interface *interface = ipv4->FindInterfaceForDevice (device);
|
||||
ipv4->Unref ();
|
||||
ArpCache * cache = new ArpCache (device, interface);
|
||||
NS_ASSERT (device->IsBroadcast ());
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/mac-address.h"
|
||||
#include "l3-protocol.h"
|
||||
#include "ns3/ptr.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
@ -41,7 +40,7 @@ class Arp : public L3Protocol
|
|||
public:
|
||||
static const uint16_t PROT_NUMBER;
|
||||
|
||||
Arp (Ptr<Node> node);
|
||||
Arp (Node *node);
|
||||
~Arp ();
|
||||
|
||||
virtual TraceResolver *CreateTraceResolver (TraceContext const &context);
|
||||
|
@ -58,7 +57,7 @@ private:
|
|||
void SendArpRequest (ArpCache const *cache, Ipv4Address to);
|
||||
void SendArpReply (ArpCache const *cache, Ipv4Address toIp, MacAddress toMac);
|
||||
CacheList m_cacheList;
|
||||
Ptr<Node> m_node;
|
||||
Node *m_node;
|
||||
};
|
||||
|
||||
}//namespace ns3
|
||||
|
|
|
@ -47,7 +47,7 @@ IIpv4Private::Send (Packet const &packet, Ipv4Address source,
|
|||
{
|
||||
m_ipv4->Send (packet, source, destination, protocol);
|
||||
}
|
||||
Ptr<Ipv4Interface>
|
||||
Ipv4Interface *
|
||||
IIpv4Private::FindInterfaceForDevice (NetDevice const*device)
|
||||
{
|
||||
return m_ipv4->FindInterfaceForDevice (device);
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "ns3/ns-unknown.h"
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
@ -45,7 +44,7 @@ public:
|
|||
TraceResolver *CreateTraceResolver (TraceContext const &context);
|
||||
void Send (Packet const &packet, Ipv4Address source,
|
||||
Ipv4Address destination, uint8_t protocol);
|
||||
Ptr<Ipv4Interface> FindInterfaceForDevice (NetDevice const*device);
|
||||
Ipv4Interface *FindInterfaceForDevice (NetDevice const*device);
|
||||
void Receive(Packet& p, NetDevice *device);
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <list>
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/object.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
@ -62,7 +61,7 @@ class TraceContext;
|
|||
* - Ipv4Interface::SendTo
|
||||
* - Ipv4Interface::DoCreateTraceResolver
|
||||
*/
|
||||
class Ipv4Interface : public Object
|
||||
class Ipv4Interface
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -63,7 +63,7 @@ Ipv4::DoDispose (void)
|
|||
{
|
||||
for (Ipv4InterfaceList::iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
|
||||
{
|
||||
::delete (*i);
|
||||
delete (*i);
|
||||
}
|
||||
m_interfaces.clear ();
|
||||
for (HostRoutesI i = m_hostRoutes.begin ();
|
||||
|
@ -319,18 +319,18 @@ Ipv4::RemoveRoute (uint32_t index)
|
|||
uint32_t
|
||||
Ipv4::AddInterface (NetDevice *device)
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = new ArpIpv4Interface (m_node, device);
|
||||
Ipv4Interface *interface = new ArpIpv4Interface (m_node, device);
|
||||
return AddIpv4Interface (interface);
|
||||
}
|
||||
uint32_t
|
||||
Ipv4::AddIpv4Interface (Ptr<Ipv4Interface> interface)
|
||||
Ipv4::AddIpv4Interface (Ipv4Interface *interface)
|
||||
{
|
||||
uint32_t index = m_nInterfaces;
|
||||
m_interfaces.push_back (interface);
|
||||
m_nInterfaces++;
|
||||
return index;
|
||||
}
|
||||
Ptr<Ipv4Interface>
|
||||
Ipv4Interface *
|
||||
Ipv4::GetInterface (uint32_t index) const
|
||||
{
|
||||
uint32_t tmp = 0;
|
||||
|
@ -350,7 +350,7 @@ Ipv4::GetNInterfaces (void) const
|
|||
return m_nInterfaces;
|
||||
}
|
||||
|
||||
Ptr<Ipv4Interface>
|
||||
Ipv4Interface *
|
||||
Ipv4::FindInterfaceForDevice (NetDevice const*device)
|
||||
{
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
|
||||
|
@ -434,7 +434,7 @@ Ipv4::SendRealOut (Packet const &p, Ipv4Header const &ip, Ipv4Route const &route
|
|||
{
|
||||
Packet packet = p;
|
||||
packet.AddHeader (ip);
|
||||
Ptr<Ipv4Interface> outInterface = GetInterface (route.GetInterface ());
|
||||
Ipv4Interface *outInterface = GetInterface (route.GetInterface ());
|
||||
NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ());
|
||||
m_txTrace (packet, route.GetInterface ());
|
||||
if (route.IsGateway ())
|
||||
|
@ -464,7 +464,7 @@ Ipv4::Forwarding (Packet const &packet, Ipv4Header &ipHeader, NetDevice *device)
|
|||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
|
||||
i != m_interfaces.end (); i++)
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = *i;
|
||||
Ipv4Interface *interface = *i;
|
||||
if (interface->PeekDevice () == device)
|
||||
{
|
||||
if (ipHeader.GetDestination ().IsEqual (interface->GetBroadcast ()))
|
||||
|
@ -520,49 +520,49 @@ Ipv4::ForwardUp (Packet p, Ipv4Header const&ip)
|
|||
void
|
||||
Ipv4::SetAddress (uint32_t i, Ipv4Address address)
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
interface->SetAddress (address);
|
||||
}
|
||||
void
|
||||
Ipv4::SetNetworkMask (uint32_t i, Ipv4Mask mask)
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
interface->SetNetworkMask (mask);
|
||||
}
|
||||
Ipv4Mask
|
||||
Ipv4::GetNetworkMask (uint32_t i) const
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
return interface->GetNetworkMask ();
|
||||
}
|
||||
Ipv4Address
|
||||
Ipv4::GetAddress (uint32_t i) const
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
return interface->GetAddress ();
|
||||
}
|
||||
uint16_t
|
||||
Ipv4::GetMtu (uint32_t i) const
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
return interface->GetMtu ();
|
||||
}
|
||||
bool
|
||||
Ipv4::IsUp (uint32_t i) const
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
return interface->IsUp ();
|
||||
}
|
||||
void
|
||||
Ipv4::SetUp (uint32_t i)
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
interface->SetUp ();
|
||||
}
|
||||
void
|
||||
Ipv4::SetDown (uint32_t i)
|
||||
{
|
||||
Ptr<Ipv4Interface> interface = GetInterface (i);
|
||||
Ipv4Interface *interface = GetInterface (i);
|
||||
interface->SetDown ();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,13 +28,12 @@
|
|||
#include "ns3/array-trace-resolver.h"
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "l3-protocol.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ipv4-interface.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Packet;
|
||||
class NetDevice;
|
||||
class Ipv4Interface;
|
||||
class Ipv4Address;
|
||||
class Ipv4Header;
|
||||
class Ipv4Route;
|
||||
|
@ -170,7 +169,7 @@ public:
|
|||
* \param i index of interface to return
|
||||
* \returns the requested interface
|
||||
*/
|
||||
Ptr<Ipv4Interface> GetInterface (uint32_t i) const;
|
||||
Ipv4Interface * GetInterface (uint32_t i) const;
|
||||
/**
|
||||
* \returns the number of interfaces added by the user.
|
||||
*/
|
||||
|
@ -182,7 +181,7 @@ public:
|
|||
* Try to find an Ipv4Interface whose NetDevice is equal to
|
||||
* the input NetDevice.
|
||||
*/
|
||||
Ptr<Ipv4Interface> FindInterfaceForDevice (NetDevice const*device);
|
||||
Ipv4Interface *FindInterfaceForDevice (NetDevice const*device);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -222,11 +221,11 @@ private:
|
|||
void SendRealOut (Packet const &packet, Ipv4Header const &ip, Ipv4Route const &route);
|
||||
bool Forwarding (Packet const &packet, Ipv4Header &ipHeader, NetDevice *device);
|
||||
void ForwardUp (Packet p, Ipv4Header const&ip);
|
||||
uint32_t AddIpv4Interface (Ptr<Ipv4Interface> interface);
|
||||
uint32_t AddIpv4Interface (Ipv4Interface *interface);
|
||||
void SetupLoopback (void);
|
||||
TraceResolver *InterfacesCreateTraceResolver (TraceContext const &context) const;
|
||||
|
||||
typedef std::list<Ptr<Ipv4Interface> > Ipv4InterfaceList;
|
||||
typedef std::list<Ipv4Interface*> Ipv4InterfaceList;
|
||||
typedef std::list<Ipv4Route *> HostRoutes;
|
||||
typedef std::list<Ipv4Route *>::const_iterator HostRoutesCI;
|
||||
typedef std::list<Ipv4Route *>::iterator HostRoutesI;
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
NodeList::Iterator Begin (void);
|
||||
NodeList::Iterator End (void);
|
||||
TraceResolver *CreateTraceResolver (TraceContext const &context);
|
||||
Ptr<Node> PeekNode (uint32_t n);
|
||||
Node *PeekNode (uint32_t n);
|
||||
uint32_t GetNNodes (void);
|
||||
|
||||
private:
|
||||
|
@ -69,7 +69,7 @@ NodeListPriv::~NodeListPriv ()
|
|||
{
|
||||
Ptr<Node> node = *i;
|
||||
node->Dispose ();
|
||||
//node->Unref ();
|
||||
*i = 0;
|
||||
}
|
||||
m_nodes.erase (m_nodes.begin (), m_nodes.end ());
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ uint32_t
|
|||
NodeListPriv::Add (Ptr<Node> node)
|
||||
{
|
||||
uint32_t index = m_nodes.size ();
|
||||
//node->Ref ();
|
||||
m_nodes.push_back (node);
|
||||
return index;
|
||||
|
||||
|
@ -99,10 +98,10 @@ NodeListPriv::GetNNodes (void)
|
|||
{
|
||||
return m_nodes.size ();
|
||||
}
|
||||
Ptr<Node>
|
||||
Node *
|
||||
NodeListPriv::PeekNode (uint32_t n)
|
||||
{
|
||||
return m_nodes[n];
|
||||
return m_nodes[n].Peek ();
|
||||
}
|
||||
|
||||
TraceResolver *
|
||||
|
|
Loading…
Reference in New Issue