From 66ef21189e133971799df84db68ffa3e2f165a6f Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Tue, 28 Dec 2021 14:43:35 -0300 Subject: [PATCH] internet: Replace m_node->GetObject with Ptr (this) --- src/internet/model/ipv4-l3-protocol.cc | 24 +++++++++--------- src/internet/model/ipv6-l3-protocol.cc | 34 +++++++++++++------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index 9d2a2867f..1f766bccc 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -592,7 +592,7 @@ Ipv4L3Protocol::Receive ( Ptr device, Ptr p, uint16_t p NS_LOG_LOGIC ("Dropping received packet -- interface is down"); Ipv4Header ipHeader; packet->RemoveHeader (ipHeader); - m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, m_node->GetObject (), interface); + m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, Ptr (this), interface); return; } @@ -612,7 +612,7 @@ Ipv4L3Protocol::Receive ( Ptr device, Ptr p, uint16_t p if (!ipHeader.IsChecksumOk ()) { NS_LOG_LOGIC ("Dropping received packet -- checksum not ok"); - m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, m_node->GetObject (), interface); + m_dropTrace (ipHeader, packet, DROP_BAD_CHECKSUM, Ptr (this), interface); return; } @@ -656,7 +656,7 @@ Ipv4L3Protocol::Receive ( Ptr device, Ptr 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, m_node->GetObject (), interface); + m_dropTrace (ipHeader, packet, DROP_DUPLICATE, Ptr (this), interface); return; } @@ -669,7 +669,7 @@ Ipv4L3Protocol::Receive ( Ptr device, Ptr p, uint16_t p )) { NS_LOG_WARN ("No route found for forwarding packet. Drop."); - m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject (), interface); + m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, Ptr (this), interface); } } @@ -898,7 +898,7 @@ Ipv4L3Protocol::Send (Ptr packet, else { NS_LOG_WARN ("No route to host. Drop."); - m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject (), 0); + m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, Ptr (this), 0); DecreaseIdentification (source, destination, protocol); } } @@ -971,7 +971,7 @@ Ipv4L3Protocol::SendRealOut (Ptr route, if (route == 0) { NS_LOG_WARN ("No route to host. Drop."); - m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, m_node->GetObject (), 0); + m_dropTrace (ipHeader, packet, DROP_NO_ROUTE, Ptr (this), 0); return; } Ptr outDev = route->GetOutputDevice (); @@ -1003,13 +1003,13 @@ Ipv4L3Protocol::SendRealOut (Ptr route, for ( std::list::iterator it = listFragments.begin (); it != listFragments.end (); it++ ) { NS_LOG_LOGIC ("Sending fragment " << *(it->first) ); - CallTxTrace (it->second, it->first, m_node->GetObject (), interface); + CallTxTrace (it->second, it->first, Ptr (this), interface); outInterface->Send (it->first, it->second, target); } } else { - CallTxTrace (ipHeader, packet, m_node->GetObject (), interface); + CallTxTrace (ipHeader, packet, Ptr (this), interface); outInterface->Send (packet, ipHeader, target); } } @@ -1036,7 +1036,7 @@ Ipv4L3Protocol::IpMulticastForward (Ptr mrtentry, PtrGetObject (), interface); + m_dropTrace (header, packet, DROP_TTL_EXPIRED, Ptr (this), interface); return; } NS_LOG_LOGIC ("Forward multicast via interface " << interface); @@ -1073,7 +1073,7 @@ Ipv4L3Protocol::IpForward (Ptr rtentry, Ptr p, const Ip icmp->SendTimeExceededTtl (ipHeader, packet, false); } NS_LOG_WARN ("TTL exceeded. Drop."); - m_dropTrace (header, packet, DROP_TTL_EXPIRED, m_node->GetObject (), interface); + m_dropTrace (header, packet, DROP_TTL_EXPIRED, Ptr (this), interface); return; } // in case the packet still has a priority tag attached, remove it @@ -1434,7 +1434,7 @@ Ipv4L3Protocol::RouteInputError (Ptr 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, m_node->GetObject (), 0); + m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, Ptr (this), 0); // \todo Send an ICMP no route. } @@ -1734,7 +1734,7 @@ Ipv4L3Protocol::HandleFragmentsTimeout (FragmentKey_t key, Ipv4Header & ipHeader Ptr icmp = GetIcmp (); icmp->SendTimeExceededTtl (ipHeader, packet, true); } - m_dropTrace (ipHeader, packet, DROP_FRAGMENT_TIMEOUT, m_node->GetObject (), iif); + m_dropTrace (ipHeader, packet, DROP_FRAGMENT_TIMEOUT, Ptr (this), iif); // clear the buffers it->second = 0; diff --git a/src/internet/model/ipv6-l3-protocol.cc b/src/internet/model/ipv6-l3-protocol.cc index aa73862aa..4cfc2d011 100644 --- a/src/internet/model/ipv6-l3-protocol.cc +++ b/src/internet/model/ipv6-l3-protocol.cc @@ -927,7 +927,7 @@ void Ipv6L3Protocol::Send (Ptr packet, Ipv6Address source, Ipv6Address d else { NS_LOG_WARN ("No route to host, drop!"); - m_dropTrace (hdr, packet, DROP_NO_ROUTE, m_node->GetObject (), GetInterfaceForDevice (oif)); + m_dropTrace (hdr, packet, DROP_NO_ROUTE, Ptr (this), GetInterfaceForDevice (oif)); } } @@ -944,14 +944,14 @@ void Ipv6L3Protocol::Receive (Ptr device, Ptr p, uint16 if (ipv6Interface->IsUp ()) { - m_rxTrace (packet, m_node->GetObject (), interface); + m_rxTrace (packet, Ptr (this), interface); } else { NS_LOG_LOGIC ("Dropping received packet-- interface is down"); Ipv6Header hdr; packet->RemoveHeader (hdr); - m_dropTrace (hdr, packet, DROP_INTERFACE_DOWN, m_node->GetObject (), interface); + m_dropTrace (hdr, packet, DROP_INTERFACE_DOWN, Ptr (this), interface); return; } @@ -1015,7 +1015,7 @@ void Ipv6L3Protocol::Receive (Ptr device, Ptr p, uint16 if (isDropped) { - m_dropTrace (hdr, packet, dropReason, m_node->GetObject (), interface); + m_dropTrace (hdr, packet, dropReason, Ptr (this), interface); } if (stopProcessing) @@ -1170,20 +1170,20 @@ void Ipv6L3Protocol::SendRealOut (Ptr route, Ptr packet, Ipv6 for (std::list::const_iterator it = fragments.begin (); it != fragments.end (); it++) { - CallTxTrace (it->second, it->first, m_node->GetObject (), interface); + CallTxTrace (it->second, it->first, Ptr (this), interface); outInterface->Send (it->first, it->second, route->GetGateway ()); } } else { - CallTxTrace (ipHeader, packet, m_node->GetObject (), interface); + CallTxTrace (ipHeader, packet, Ptr (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, m_node->GetObject (), interface); + m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, Ptr (this), interface); } } else @@ -1198,20 +1198,20 @@ void Ipv6L3Protocol::SendRealOut (Ptr route, Ptr packet, Ipv6 for (std::list::const_iterator it = fragments.begin (); it != fragments.end (); it++) { - CallTxTrace (it->second, it->first, m_node->GetObject (), interface); + CallTxTrace (it->second, it->first, Ptr (this), interface); outInterface->Send (it->first, it->second, ipHeader.GetDestination ()); } } else { - CallTxTrace (ipHeader, packet, m_node->GetObject (), interface); + CallTxTrace (ipHeader, packet, Ptr (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, m_node->GetObject (), interface); + m_dropTrace (ipHeader, packet, DROP_INTERFACE_DOWN, Ptr (this), interface); } } } @@ -1225,7 +1225,7 @@ void Ipv6L3Protocol::IpForward (Ptr idev, Ptr 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, m_node->GetObject (), 0); + m_dropTrace (header, p, DROP_ROUTE_ERROR, Ptr (this), 0); return; } @@ -1243,7 +1243,7 @@ void Ipv6L3Protocol::IpForward (Ptr idev, Ptr rtentr if (ipHeader.GetHopLimit () == 0) { NS_LOG_WARN ("TTL exceeded. Drop."); - m_dropTrace (ipHeader, packet, DROP_TTL_EXPIRED, m_node->GetObject (), 0); + m_dropTrace (ipHeader, packet, DROP_TTL_EXPIRED, Ptr (this), 0); // Do not reply to multicast IPv6 address if (ipHeader.GetDestination ().IsMulticast () == false) { @@ -1318,7 +1318,7 @@ void Ipv6L3Protocol::IpMulticastForward (Ptr idev, PtrGetObject (), interfaceId); + m_dropTrace (header, packet, DROP_TTL_EXPIRED, Ptr (this), interfaceId); return; } NS_LOG_LOGIC ("Forward multicast via interface " << interfaceId); @@ -1375,7 +1375,7 @@ void Ipv6L3Protocol::LocalDeliver (Ptr packet, Ipv6Header const& i if (isDropped) { - m_dropTrace (ip, packet, dropReason, m_node->GetObject (), iif); + m_dropTrace (ip, packet, dropReason, Ptr (this), iif); } if (stopProcessing) @@ -1405,7 +1405,7 @@ void Ipv6L3Protocol::LocalDeliver (Ptr packet, Ipv6Header const& i { GetIcmpv6 ()->SendErrorParameterError (malformedPacket, dst, Icmpv6Header::ICMPV6_UNKNOWN_NEXT_HEADER, ip.GetSerializedSize () + nextHeaderPosition); } - m_dropTrace (ip, p, DROP_UNKNOWN_PROTOCOL, m_node->GetObject (), iif); + m_dropTrace (ip, p, DROP_UNKNOWN_PROTOCOL, Ptr (this), iif); break; } else @@ -1449,7 +1449,7 @@ void Ipv6L3Protocol::RouteInputError (Ptr 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, m_node->GetObject (), 0); + m_dropTrace (ipHeader, p, DROP_ROUTE_ERROR, Ptr (this), 0); if (!ipHeader.GetDestination ().IsMulticast ()) { @@ -1530,7 +1530,7 @@ void Ipv6L3Protocol::RegisterOptions () void Ipv6L3Protocol::ReportDrop (Ipv6Header ipHeader, Ptr p, DropReason dropReason) { - m_dropTrace (ipHeader, p, dropReason, m_node->GetObject (), 0); + m_dropTrace (ipHeader, p, dropReason, Ptr (this), 0); } void Ipv6L3Protocol::AddMulticastAddress (Ipv6Address address, uint32_t interface)