Replace Ptr (this) with this

This commit is contained in:
Gabriel Arrobo
2022-03-24 11:24:14 -07:00
parent ee2a5e4fd2
commit 9beeff24f3
2 changed files with 30 additions and 30 deletions

View File

@@ -585,14 +585,14 @@ Ipv4L3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t p
if (ipv4Interface->IsUp ())
{
m_rxTrace (packet, m_node->GetObject<Ipv4> (), interface);
m_rxTrace (packet, this, interface);
}
else
{
NS_LOG_LOGIC ("Dropping received packet -- interface is down");
Ipv4Header ipHeader;
packet->RemoveHeader (ipHeader);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, Ptr (this), interface);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, this, interface);
return;
}
@@ -612,7 +612,7 @@ Ipv4L3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t p
if (!ipHeader.IsChecksumOk ())
{
NS_LOG_LOGIC ("Dropping received packet -- checksum not ok");
m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, Ptr (this), interface);
m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, this, interface);
return;
}
@@ -656,7 +656,7 @@ Ipv4L3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t p
if (m_enableDpd && ipHeader.GetDestination ().IsMulticast () && UpdateDuplicate (packet, ipHeader))
{
NS_LOG_LOGIC ("Dropping received packet -- duplicate.");
m_dropTrace (ipHeader, packet, DROP_DUPLICATE, Ptr (this), interface);
m_dropTrace (ipHeader, packet, DROP_DUPLICATE, this, interface);
return;
}
@@ -669,7 +669,7 @@ Ipv4L3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t p
))
{
NS_LOG_WARN ("No route found for forwarding packet. Drop.");
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, Ptr (this), interface);
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, this, interface);
}
}
@@ -898,7 +898,7 @@ Ipv4L3Protocol::Send (Ptr<Packet> packet,
else
{
NS_LOG_WARN ("No route to host. Drop.");
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, Ptr (this), 0);
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, this, 0);
DecreaseIdentification (source, destination, protocol);
}
}
@@ -971,7 +971,7 @@ Ipv4L3Protocol::SendRealOut (Ptr<Ipv4Route> route,
if (route == 0)
{
NS_LOG_WARN ("No route to host. Drop.");
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, Ptr (this), 0);
m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, this, 0);
return;
}
Ptr<NetDevice> outDev = route->GetOutputDevice ();
@@ -1003,13 +1003,13 @@ Ipv4L3Protocol::SendRealOut (Ptr<Ipv4Route> route,
for ( std::list<Ipv4PayloadHeaderPair>::iterator it = listFragments.begin (); it != listFragments.end (); it++ )
{
NS_LOG_LOGIC ("Sending fragment " << *(it->first) );
CallTxTrace (it->second, it->first, Ptr (this), interface);
CallTxTrace (it->second, it->first, this, interface);
outInterface->Send (it->first, it->second, target);
}
}
else
{
CallTxTrace (ipHeader, packet, Ptr (this), interface);
CallTxTrace (ipHeader, packet, this, interface);
outInterface->Send (packet, ipHeader, target);
}
}
@@ -1036,7 +1036,7 @@ Ipv4L3Protocol::IpMulticastForward (Ptr<Ipv4MulticastRoute> mrtentry, Ptr<const
if (ipHeader.GetTtl () == 0)
{
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (header, packet, DROP_TTL_EXPIRED, Ptr (this), interface);
m_dropTrace (header, packet, DROP_TTL_EXPIRED, this, interface);
return;
}
NS_LOG_LOGIC ("Forward multicast via interface " << interface);
@@ -1073,7 +1073,7 @@ Ipv4L3Protocol::IpForward (Ptr<Ipv4Route> rtentry, Ptr<const Packet> p, const Ip
icmp->SendTimeExceededTtl (ipHeader, packet, false);
}
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (header, packet, DROP_TTL_EXPIRED, Ptr (this), interface);
m_dropTrace (header, packet, DROP_TTL_EXPIRED, this, interface);
return;
}
// in case the packet still has a priority tag attached, remove it
@@ -1434,7 +1434,7 @@ Ipv4L3Protocol::RouteInputError (Ptr<const Packet> p, const Ipv4Header & ipHeade
{
NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno);
m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, Ptr (this), 0);
m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, this, 0);
// \todo Send an ICMP no route.
}
@@ -1734,7 +1734,7 @@ Ipv4L3Protocol::HandleFragmentsTimeout (FragmentKey_t key, Ipv4Header & ipHeader
Ptr<Icmpv4L4Protocol> icmp = GetIcmp ();
icmp->SendTimeExceededTtl (ipHeader, packet, true);
}
m_dropTrace (ipHeader, packet, DROP_FRAGMENT_TIMEOUT, Ptr (this), iif);
m_dropTrace (ipHeader, packet, DROP_FRAGMENT_TIMEOUT, this, iif);
// clear the buffers
it->second = 0;

View File

@@ -927,7 +927,7 @@ void Ipv6L3Protocol::Send (Ptr<Packet> packet, Ipv6Address source, Ipv6Address d
else
{
NS_LOG_WARN ("No route to host, drop!");
m_dropTrace (hdr, packet, DROP_NO_ROUTE, Ptr (this), GetInterfaceForDevice (oif));
m_dropTrace (hdr, packet, DROP_NO_ROUTE, this, GetInterfaceForDevice (oif));
}
}
@@ -944,14 +944,14 @@ void Ipv6L3Protocol::Receive (Ptr<NetDevice> device, Ptr<const Packet> p, uint16
if (ipv6Interface->IsUp ())
{
m_rxTrace (packet, Ptr (this), interface);
m_rxTrace (packet, this, interface);
}
else
{
NS_LOG_LOGIC ("Dropping received packet-- interface is down");
Ipv6Header hdr;
packet->RemoveHeader (hdr);
m_dropTrace (hdr, packet, DROP_INTERFACE_DOWN, Ptr (this), interface);
m_dropTrace (hdr, packet, DROP_INTERFACE_DOWN, this, interface);
return;
}
@@ -1015,7 +1015,7 @@ void Ipv6L3Protocol::Receive (Ptr<NetDevice> device, Ptr<const Packet> p, uint16
if (isDropped)
{
m_dropTrace (hdr, packet, dropReason, Ptr (this), interface);
m_dropTrace (hdr, packet, dropReason, this, interface);
}
if (stopProcessing)
@@ -1177,20 +1177,20 @@ void Ipv6L3Protocol::SendRealOut (Ptr<Ipv6Route> route, Ptr<Packet> packet, Ipv6
for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it = fragments.begin (); it != fragments.end (); it++)
{
CallTxTrace (it->second, it->first, Ptr (this), interface);
CallTxTrace (it->second, it->first, this, interface);
outInterface->Send (it->first, it->second, route->GetGateway ());
}
}
else
{
CallTxTrace (ipHeader, packet, Ptr (this), interface);
CallTxTrace (ipHeader, packet, this, interface);
outInterface->Send (packet, ipHeader, route->GetGateway ());
}
}
else
{
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << route->GetGateway ());
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, Ptr (this), interface);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, this, interface);
}
}
else
@@ -1205,20 +1205,20 @@ void Ipv6L3Protocol::SendRealOut (Ptr<Ipv6Route> route, Ptr<Packet> packet, Ipv6
for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it = fragments.begin (); it != fragments.end (); it++)
{
CallTxTrace (it->second, it->first, Ptr (this), interface);
CallTxTrace (it->second, it->first, this, interface);
outInterface->Send (it->first, it->second, ipHeader.GetDestination ());
}
}
else
{
CallTxTrace (ipHeader, packet, Ptr (this), interface);
CallTxTrace (ipHeader, packet, this, interface);
outInterface->Send (packet, ipHeader, ipHeader.GetDestination ());
}
}
else
{
NS_LOG_LOGIC ("Dropping-- outgoing interface is down: " << ipHeader.GetDestination ());
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, Ptr (this), interface);
m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, this, interface);
}
}
}
@@ -1232,7 +1232,7 @@ void Ipv6L3Protocol::IpForward (Ptr<const NetDevice> idev, Ptr<Ipv6Route> rtentr
if (header.GetDestination().IsDocumentation ())
{
NS_LOG_WARN ("Received a packet for 2001:db8::/32 (documentation class). Drop.");
m_dropTrace (header, p, DROP_ROUTE_ERROR, Ptr (this), 0);
m_dropTrace (header, p, DROP_ROUTE_ERROR, this, 0);
return;
}
@@ -1250,7 +1250,7 @@ void Ipv6L3Protocol::IpForward (Ptr<const NetDevice> idev, Ptr<Ipv6Route> rtentr
if (ipHeader.GetHopLimit () == 0)
{
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (ipHeader, packet, DROP_TTL_EXPIRED, Ptr (this), 0);
m_dropTrace (ipHeader, packet, DROP_TTL_EXPIRED, this, 0);
// Do not reply to multicast IPv6 address
if (ipHeader.GetDestination ().IsMulticast () == false)
{
@@ -1325,7 +1325,7 @@ void Ipv6L3Protocol::IpMulticastForward (Ptr<const NetDevice> idev, Ptr<Ipv6Mult
if (h.GetHopLimit () == 0)
{
NS_LOG_WARN ("TTL exceeded. Drop.");
m_dropTrace (header, packet, DROP_TTL_EXPIRED, Ptr (this), interfaceId);
m_dropTrace (header, packet, DROP_TTL_EXPIRED, this, interfaceId);
return;
}
NS_LOG_LOGIC ("Forward multicast via interface " << interfaceId);
@@ -1382,7 +1382,7 @@ void Ipv6L3Protocol::LocalDeliver (Ptr<const Packet> packet, Ipv6Header const& i
if (isDropped)
{
m_dropTrace (ip, packet, dropReason, Ptr (this), iif);
m_dropTrace (ip, packet, dropReason, this, iif);
}
if (stopProcessing)
@@ -1412,7 +1412,7 @@ void Ipv6L3Protocol::LocalDeliver (Ptr<const Packet> packet, Ipv6Header const& i
{
GetIcmpv6 ()->SendErrorParameterError (malformedPacket, dst, Icmpv6Header::ICMPV6_UNKNOWN_NEXT_HEADER, ip.GetSerializedSize () + nextHeaderPosition);
}
m_dropTrace (ip, p, DROP_UNKNOWN_PROTOCOL, Ptr (this), iif);
m_dropTrace (ip, p, DROP_UNKNOWN_PROTOCOL, this, iif);
break;
}
else
@@ -1456,7 +1456,7 @@ void Ipv6L3Protocol::RouteInputError (Ptr<const Packet> p, const Ipv6Header& ipH
NS_LOG_FUNCTION (this << p << ipHeader << sockErrno);
NS_LOG_LOGIC ("Route input failure-- dropping packet to " << ipHeader << " with errno " << sockErrno);
m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, Ptr (this), 0);
m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, this, 0);
if (!ipHeader.GetDestination ().IsMulticast ())
{
@@ -1537,7 +1537,7 @@ void Ipv6L3Protocol::RegisterOptions ()
void Ipv6L3Protocol::ReportDrop (Ipv6Header ipHeader, Ptr<Packet> p, DropReason dropReason)
{
m_dropTrace (ipHeader, p, dropReason, Ptr (this), 0);
m_dropTrace (ipHeader, p, dropReason, this, 0);
}
void Ipv6L3Protocol::AddMulticastAddress (Ipv6Address address, uint32_t interface)