Further work on cleaning up function logging of internet module.
--- a/src/internet/model/icmpv6-l4-protocol.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/icmpv6-l4-protocol.cc Sat Apr 20 16:49:31 2013 +0200
@@ -248,6 +248,8 @@
uint32_t info, Ipv6Header ipHeader,
const uint8_t payload[8])
{
+ NS_LOG_FUNCTION (this << source << icmp << info << ipHeader << payload);
+
Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
// TODO assuming the ICMP is carrying a extensionless IP packet
@@ -778,7 +780,7 @@
void Icmpv6L4Protocol::HandleDestinationUnreachable (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
- NS_LOG_FUNCTION (this << *p << src << dst);
+ NS_LOG_FUNCTION (this << *p << src << dst << interface);
Ptr<Packet> pkt = p->Copy ();
Icmpv6DestinationUnreachable unreach;
@@ -797,7 +799,7 @@
void Icmpv6L4Protocol::HandleTimeExceeded (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
- NS_LOG_FUNCTION (this << *p << src << dst);
+ NS_LOG_FUNCTION (this << *p << src << dst << interface);
Ptr<Packet> pkt = p->Copy ();
Icmpv6TimeExceeded timeexceeded;
@@ -813,7 +815,7 @@
void Icmpv6L4Protocol::HandlePacketTooBig (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
- NS_LOG_FUNCTION (this << *p << src << dst);
+ NS_LOG_FUNCTION (this << *p << src << dst << interface);
Ptr<Packet> pkt = p->Copy ();
Icmpv6TooBig tooBig;
@@ -829,7 +831,7 @@
void Icmpv6L4Protocol::HandleParameterError (Ptr<Packet> p, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
{
- NS_LOG_FUNCTION (this << *p << src << dst);
+ NS_LOG_FUNCTION (this << *p << src << dst << interface);
Ptr<Packet> pkt = p->Copy ();
Icmpv6ParameterError paramErr;
@@ -888,7 +890,7 @@
void Icmpv6L4Protocol::SendNA (Ipv6Address src, Ipv6Address dst, Address* hardwareAddress, uint8_t flags)
{
- NS_LOG_FUNCTION (this << src << dst << hardwareAddress << flags);
+ NS_LOG_FUNCTION (this << src << dst << hardwareAddress << static_cast<uint32_t> (flags));
Ptr<Packet> p = Create<Packet> ();
Icmpv6NA na;
Icmpv6OptionLinkLayerAddress llOption (0, *hardwareAddress); /* not a source link layer */
@@ -1023,7 +1025,7 @@
void Icmpv6L4Protocol::SendErrorTimeExceeded (Ptr<Packet> malformedPacket, Ipv6Address dst, uint8_t code)
{
- NS_LOG_FUNCTION (this << malformedPacket << dst << code);
+ NS_LOG_FUNCTION (this << malformedPacket << dst << static_cast<uint32_t> (code));
Ptr<Packet> p = Create<Packet> ();
uint32_t malformedPacketSize = malformedPacket->GetSize ();
Icmpv6TimeExceeded header;
@@ -1047,7 +1049,7 @@
void Icmpv6L4Protocol::SendErrorParameterError (Ptr<Packet> malformedPacket, Ipv6Address dst, uint8_t code, uint32_t ptr)
{
- NS_LOG_FUNCTION (this << malformedPacket << dst << code << ptr);
+ NS_LOG_FUNCTION (this << malformedPacket << dst << static_cast<uint32_t> (code) << ptr);
Ptr<Packet> p = Create<Packet> ();
uint32_t malformedPacketSize = malformedPacket->GetSize ();
Icmpv6ParameterError header;
@@ -1210,6 +1212,8 @@
Ptr<NdiscCache> Icmpv6L4Protocol::CreateCache (Ptr<NetDevice> device, Ptr<Ipv6Interface> interface)
{
+ NS_LOG_FUNCTION (this << device << interface);
+
Ptr<NdiscCache> cache = CreateObject<NdiscCache> ();
cache->SetDevice (device, interface);
@@ -1220,7 +1224,7 @@
bool Icmpv6L4Protocol::Lookup (Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination)
{
- NS_LOG_FUNCTION (this << dst << device << hardwareDestination);
+ NS_LOG_FUNCTION (this << dst << device << cache << hardwareDestination);
if (!cache)
{
@@ -1233,7 +1237,7 @@
bool Icmpv6L4Protocol::Lookup (Ptr<Packet> p, Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination)
{
- NS_LOG_FUNCTION (this << p << dst << device << hardwareDestination);
+ NS_LOG_FUNCTION (this << p << dst << device << cache << hardwareDestination);
if (!cache)
{
@@ -1348,23 +1352,27 @@
void
Icmpv6L4Protocol::SetDownTarget (IpL4Protocol::DownTargetCallback callback)
{
+ NS_LOG_FUNCTION (this << &callback);
}
void
Icmpv6L4Protocol::SetDownTarget6 (IpL4Protocol::DownTargetCallback6 callback)
{
+ NS_LOG_FUNCTION (this << &callback);
m_downTarget = callback;
}
IpL4Protocol::DownTargetCallback
Icmpv6L4Protocol::GetDownTarget (void) const
{
+ NS_LOG_FUNCTION (this);
return (IpL4Protocol::DownTargetCallback)NULL;
}
IpL4Protocol::DownTargetCallback6
Icmpv6L4Protocol::GetDownTarget6 (void) const
{
+ NS_LOG_FUNCTION (this);
return m_downTarget;
}
--- a/src/internet/model/ip-l4-protocol.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ip-l4-protocol.cc Sat Apr 20 16:49:31 2013 +0200
@@ -23,6 +23,9 @@
#include "ip-l4-protocol.h"
#include "ns3/uinteger.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("IpL4Protocol");
namespace ns3 {
@@ -43,6 +46,7 @@
IpL4Protocol::~IpL4Protocol ()
{
+ NS_LOG_FUNCTION (this);
}
void
@@ -50,12 +54,16 @@
uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
Ipv4Address payloadSource,Ipv4Address payloadDestination,
const uint8_t payload[8])
-{}
+{
+ NS_LOG_FUNCTION (this << icmpSource << static_cast<uint32_t> (icmpTtl) << static_cast<uint32_t> (icmpType) << static_cast<uint32_t> (icmpCode) << icmpInfo << payloadSource << payloadDestination << payload);
+}
void
IpL4Protocol::ReceiveIcmp (Ipv6Address icmpSource, uint8_t icmpTtl,
uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo,
Ipv6Address payloadSource, Ipv6Address payloadDestination,
const uint8_t payload[8])
-{}
+{
+ NS_LOG_FUNCTION (this << icmpSource << static_cast<uint32_t> (icmpTtl) << static_cast<uint32_t> (icmpType) << static_cast<uint32_t> (icmpCode) << icmpInfo << payloadSource << payloadDestination << payload);
+}
} //namespace ns3
--- a/src/internet/model/ipv4-address-generator.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-address-generator.cc Sat Apr 20 16:49:31 2013 +0200
@@ -79,14 +79,14 @@
Ipv4AddressGeneratorImpl::Ipv4AddressGeneratorImpl ()
: m_entries (), m_test (false)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
Reset ();
}
void
Ipv4AddressGeneratorImpl::Reset (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
uint32_t mask = 0;
//
@@ -124,7 +124,7 @@
Ipv4AddressGeneratorImpl::~Ipv4AddressGeneratorImpl ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
void
@@ -133,7 +133,7 @@
const Ipv4Mask mask,
const Ipv4Address addr)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << net << mask << addr);
//
// We're going to be playing with the actual bits in the network and mask so
// pull them out into ints.
@@ -165,7 +165,7 @@
Ipv4AddressGeneratorImpl::GetNetwork (
const Ipv4Mask mask) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << mask);
uint32_t index = MaskToIndex (mask);
return Ipv4Address (m_netTable[index].network << m_netTable[index].shift);
@@ -175,7 +175,7 @@
Ipv4AddressGeneratorImpl::NextNetwork (
const Ipv4Mask mask)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << mask);
//
// The way this is expected to be used is that an address and network prefix
// are initialized, and then NextAddress() is called repeatedly to set the
@@ -195,7 +195,7 @@
const Ipv4Address addr,
const Ipv4Mask mask)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << addr << mask);
uint32_t index = MaskToIndex (mask);
uint32_t addrBits = addr.Get ();
@@ -208,7 +208,7 @@
Ipv4AddressGeneratorImpl::GetAddress (
const Ipv4Mask mask) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << mask);
uint32_t index = MaskToIndex (mask);
@@ -220,7 +220,7 @@
Ipv4Address
Ipv4AddressGeneratorImpl::NextAddress (const Ipv4Mask mask)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << mask);
//
// The way this is expected to be used is that an address and network prefix
// are initialized, and then NextAddress() is called repeatedly to set the
@@ -249,7 +249,7 @@
bool
Ipv4AddressGeneratorImpl::AddAllocated (const Ipv4Address address)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << address);
uint32_t addr = address.Get ();
@@ -337,13 +337,16 @@
void
Ipv4AddressGeneratorImpl::TestMode (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_test = true;
}
uint32_t
Ipv4AddressGeneratorImpl::MaskToIndex (Ipv4Mask mask) const
{
+
+ NS_LOG_FUNCTION (this << mask);
+
//
// We've been given a mask that has a higher order bit set for each bit of the
// network number. In order to translate this mask into an index, we just need
--- a/src/internet/model/ipv4-end-point-demux.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-end-point-demux.cc Sat Apr 20 16:49:31 2013 +0200
@@ -29,12 +29,12 @@
Ipv4EndPointDemux::Ipv4EndPointDemux ()
: m_ephemeral (49152), m_portLast (65535), m_portFirst (49152)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
Ipv4EndPointDemux::~Ipv4EndPointDemux ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
{
Ipv4EndPoint *endPoint = *i;
@@ -46,7 +46,7 @@
bool
Ipv4EndPointDemux::LookupPortLocal (uint16_t port)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << port);
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
{
if ((*i)->GetLocalPort () == port)
@@ -60,7 +60,7 @@
bool
Ipv4EndPointDemux::LookupLocal (Ipv4Address addr, uint16_t port)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << addr << port);
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
{
if ((*i)->GetLocalPort () == port &&
@@ -75,7 +75,7 @@
Ipv4EndPoint *
Ipv4EndPointDemux::Allocate (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
uint16_t port = AllocateEphemeralPort ();
if (port == 0)
{
@@ -156,7 +156,7 @@
void
Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << endPoint);
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
{
if (*i == endPoint)
@@ -174,7 +174,7 @@
Ipv4EndPointDemux::EndPoints
Ipv4EndPointDemux::GetAllEndPoints (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
EndPoints ret;
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
@@ -196,13 +196,13 @@
Ipv4Address saddr, uint16_t sport,
Ptr<Ipv4Interface> incomingInterface)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << daddr << dport << saddr << sport << incomingInterface);
+
EndPoints retval1; // Matches exact on local port, wildcards on others
EndPoints retval2; // Matches exact on local port/adder, wildcards on others
EndPoints retval3; // Matches all but local address
EndPoints retval4; // Exact match on all 4
- NS_LOG_FUNCTION (this << daddr << dport << saddr << sport << incomingInterface);
NS_LOG_DEBUG ("Looking up endpoint for destination address " << daddr);
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
{
@@ -313,6 +313,8 @@
Ipv4Address saddr,
uint16_t sport)
{
+ NS_LOG_FUNCTION (this << daddr << dport << saddr << sport);
+
// this code is a copy/paste version of an old BSD ip stack lookup
// function.
uint32_t genericity = 3;
@@ -351,7 +353,7 @@
Ipv4EndPointDemux::AllocateEphemeralPort (void)
{
// Similar to counting up logic in netinet/in_pcb.c
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
uint16_t port = m_ephemeral;
int count = m_portLast - m_portFirst;
do
--- a/src/internet/model/ipv4-end-point.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-end-point.cc Sat Apr 20 16:49:31 2013 +0200
@@ -33,9 +33,11 @@
m_peerAddr (Ipv4Address::GetAny ()),
m_peerPort (0)
{
+ NS_LOG_FUNCTION (this << address << port);
}
Ipv4EndPoint::~Ipv4EndPoint ()
{
+ NS_LOG_FUNCTION (this);
if (!m_destroyCallback.IsNull ())
{
m_destroyCallback ();
@@ -48,33 +50,39 @@
Ipv4Address
Ipv4EndPoint::GetLocalAddress (void)
{
+ NS_LOG_FUNCTION (this);
return m_localAddr;
}
void
Ipv4EndPoint::SetLocalAddress (Ipv4Address address)
{
+ NS_LOG_FUNCTION (this << address);
m_localAddr = address;
}
uint16_t
Ipv4EndPoint::GetLocalPort (void)
{
+ NS_LOG_FUNCTION (this);
return m_localPort;
}
Ipv4Address
Ipv4EndPoint::GetPeerAddress (void)
{
+ NS_LOG_FUNCTION (this);
return m_peerAddr;
}
uint16_t
Ipv4EndPoint::GetPeerPort (void)
{
+ NS_LOG_FUNCTION (this);
return m_peerPort;
}
void
Ipv4EndPoint::SetPeer (Ipv4Address address, uint16_t port)
{
+ NS_LOG_FUNCTION (this << address << port);
m_peerAddr = address;
m_peerPort = port;
}
@@ -82,6 +90,7 @@
void
Ipv4EndPoint::BindToNetDevice (Ptr<NetDevice> netdevice)
{
+ NS_LOG_FUNCTION (this << netdevice);
m_boundnetdevice = netdevice;
return;
}
@@ -89,23 +98,27 @@
Ptr<NetDevice>
Ipv4EndPoint::GetBoundNetDevice (void)
{
+ NS_LOG_FUNCTION (this);
return m_boundnetdevice;
}
void
Ipv4EndPoint::SetRxCallback (Callback<void,Ptr<Packet>, Ipv4Header, uint16_t, Ptr<Ipv4Interface> > callback)
{
+ NS_LOG_FUNCTION (this << &callback);
m_rxCallback = callback;
}
void
Ipv4EndPoint::SetIcmpCallback (Callback<void,Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t> callback)
{
+ NS_LOG_FUNCTION (this << &callback);
m_icmpCallback = callback;
}
void
Ipv4EndPoint::SetDestroyCallback (Callback<void> callback)
{
+ NS_LOG_FUNCTION (this << &callback);
m_destroyCallback = callback;
}
@@ -113,6 +126,8 @@
Ipv4EndPoint::ForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport,
Ptr<Ipv4Interface> incomingInterface)
{
+ NS_LOG_FUNCTION (this << p << &header << sport << incomingInterface);
+
if (!m_rxCallback.IsNull ())
{
Simulator::ScheduleNow (&Ipv4EndPoint::DoForwardUp, this, p, header, sport,
@@ -123,6 +138,8 @@
Ipv4EndPoint::DoForwardUp (Ptr<Packet> p, const Ipv4Header& header, uint16_t sport,
Ptr<Ipv4Interface> incomingInterface)
{
+ NS_LOG_FUNCTION (this << p << &header << sport << incomingInterface);
+
if (!m_rxCallback.IsNull ())
{
m_rxCallback (p, header, sport, incomingInterface);
@@ -147,6 +164,8 @@
uint8_t icmpType, uint8_t icmpCode,
uint32_t icmpInfo)
{
+ NS_LOG_FUNCTION (this << icmpSource << static_cast<uint32_t> (icmpTtl) << static_cast<uint32_t> (icmpType) << static_cast<uint32_t> (icmpCode) << icmpInfo);
+
if (!m_icmpCallback.IsNull ())
{
m_icmpCallback (icmpSource,icmpTtl,icmpType,icmpCode,icmpInfo);
--- a/src/internet/model/ipv4-global-routing.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-global-routing.cc Sat Apr 20 16:49:31 2013 +0200
@@ -124,7 +124,7 @@
Ipv4Address nextHop,
uint32_t interface)
{
- NS_LOG_FUNCTION (this << network << networkMask << nextHop);
+ NS_LOG_FUNCTION (this << network << networkMask << nextHop << interface);
Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry ();
*route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network,
networkMask,
@@ -398,6 +398,7 @@
void
Ipv4GlobalRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
+ NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
if (GetNRoutes () > 0)
{
@@ -444,7 +445,7 @@
Ptr<Ipv4Route>
Ipv4GlobalRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
{
-
+ NS_LOG_FUNCTION (this << p << &header << oif << &sockerr);
//
// First, see if this is a multicast packet we have a route for. If we
// have a route, then send the packet down each of the specified interfaces.
@@ -474,8 +475,7 @@
Ipv4GlobalRouting::RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb)
{
-
- NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev);
+ NS_LOG_FUNCTION (this << p << header << header.GetSource () << header.GetDestination () << idev << &lcb << &ecb);
// Check if input device supports IP
NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
--- a/src/internet/model/ipv4-header.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-header.cc Sat Apr 20 16:49:31 2013 +0200
@@ -48,40 +48,47 @@
void
Ipv4Header::EnableChecksum (void)
{
+ NS_LOG_FUNCTION (this);
m_calcChecksum = true;
}
void
Ipv4Header::SetPayloadSize (uint16_t size)
{
+ NS_LOG_FUNCTION (this << size);
m_payloadSize = size;
}
uint16_t
Ipv4Header::GetPayloadSize (void) const
{
+ NS_LOG_FUNCTION (this);
return m_payloadSize;
}
uint16_t
Ipv4Header::GetIdentification (void) const
{
+ NS_LOG_FUNCTION (this);
return m_identification;
}
void
Ipv4Header::SetIdentification (uint16_t identification)
{
+ NS_LOG_FUNCTION (this << identification);
m_identification = identification;
}
void
Ipv4Header::SetTos (uint8_t tos)
{
+ NS_LOG_FUNCTION (this << static_cast<uint32_t> (tos));
m_tos = tos;
}
void
Ipv4Header::SetDscp (DscpType dscp)
{
+ NS_LOG_FUNCTION (this << dscp);
m_tos &= 0x3; // Clear out the DSCP part, retain 2 bits of ECN
m_tos |= dscp;
}
@@ -89,6 +96,7 @@
void
Ipv4Header::SetEcn (EcnType ecn)
{
+ NS_LOG_FUNCTION (this << ecn);
m_tos &= 0xFC; // Clear out the ECN part, retain 6 bits of DSCP
m_tos |= ecn;
}
@@ -96,6 +104,7 @@
Ipv4Header::DscpType
Ipv4Header::GetDscp (void) const
{
+ NS_LOG_FUNCTION (this);
// Extract only first 6 bits of TOS byte, i.e 0xFC
return DscpType (m_tos & 0xFC);
}
@@ -103,6 +112,7 @@
std::string
Ipv4Header::DscpTypeToString (DscpType dscp) const
{
+ NS_LOG_FUNCTION (this << dscp);
switch (dscp)
{
case DscpDefault:
@@ -156,6 +166,7 @@
Ipv4Header::EcnType
Ipv4Header::GetEcn (void) const
{
+ NS_LOG_FUNCTION (this);
// Extract only last 2 bits of TOS byte, i.e 0x3
return EcnType (m_tos & 0x3);
}
@@ -163,6 +174,7 @@
std::string
Ipv4Header::EcnTypeToString (EcnType ecn) const
{
+ NS_LOG_FUNCTION (this << ecn);
switch (ecn)
{
case NotECT:
@@ -181,43 +193,51 @@
uint8_t
Ipv4Header::GetTos (void) const
{
+ NS_LOG_FUNCTION (this);
return m_tos;
}
void
Ipv4Header::SetMoreFragments (void)
{
+ NS_LOG_FUNCTION (this);
m_flags |= MORE_FRAGMENTS;
}
void
Ipv4Header::SetLastFragment (void)
{
+ NS_LOG_FUNCTION (this);
m_flags &= ~MORE_FRAGMENTS;
}
bool
Ipv4Header::IsLastFragment (void) const
{
+ NS_LOG_FUNCTION (this);
return !(m_flags & MORE_FRAGMENTS);
}
void
Ipv4Header::SetDontFragment (void)
{
+ NS_LOG_FUNCTION (this);
m_flags |= DONT_FRAGMENT;
}
void
Ipv4Header::SetMayFragment (void)
{
+ NS_LOG_FUNCTION (this);
m_flags &= ~DONT_FRAGMENT;
}
bool
Ipv4Header::IsDontFragment (void) const
{
+ NS_LOG_FUNCTION (this);
return (m_flags & DONT_FRAGMENT);
}
void
Ipv4Header::SetFragmentOffset (uint16_t offsetBytes)
{
+ NS_LOG_FUNCTION (this << offsetBytes);
// check if the user is trying to set an invalid offset
NS_ABORT_MSG_IF ((offsetBytes & 0x7), "offsetBytes must be multiple of 8 bytes");
m_fragmentOffset = offsetBytes;
@@ -225,6 +245,7 @@
uint16_t
Ipv4Header::GetFragmentOffset (void) const
{
+ NS_LOG_FUNCTION (this);
if ((m_fragmentOffset+m_payloadSize+5*4) > 65535)
{
NS_LOG_WARN("Fragment will exceed the maximum packet size once reassembled");
@@ -236,44 +257,52 @@
void
Ipv4Header::SetTtl (uint8_t ttl)
{
+ NS_LOG_FUNCTION (this << static_cast<uint32_t> (ttl));
m_ttl = ttl;
}
uint8_t
Ipv4Header::GetTtl (void) const
{
+ NS_LOG_FUNCTION (this);
return m_ttl;
}
uint8_t
Ipv4Header::GetProtocol (void) const
{
+ NS_LOG_FUNCTION (this);
return m_protocol;
}
void
Ipv4Header::SetProtocol (uint8_t protocol)
{
+ NS_LOG_FUNCTION (this << static_cast<uint32_t> (protocol));
m_protocol = protocol;
}
void
Ipv4Header::SetSource (Ipv4Address source)
{
+ NS_LOG_FUNCTION (this << source);
m_source = source;
}
Ipv4Address
Ipv4Header::GetSource (void) const
{
+ NS_LOG_FUNCTION (this);
return m_source;
}
void
Ipv4Header::SetDestination (Ipv4Address dst)
{
+ NS_LOG_FUNCTION (this << dst);
m_destination = dst;
}
Ipv4Address
Ipv4Header::GetDestination (void) const
{
+ NS_LOG_FUNCTION (this);
return m_destination;
}
@@ -281,6 +310,7 @@
bool
Ipv4Header::IsChecksumOk (void) const
{
+ NS_LOG_FUNCTION (this);
return m_goodChecksum;
}
@@ -296,11 +326,13 @@
TypeId
Ipv4Header::GetInstanceTypeId (void) const
{
+ NS_LOG_FUNCTION (this);
return GetTypeId ();
}
void
Ipv4Header::Print (std::ostream &os) const
{
+ NS_LOG_FUNCTION (this << &os);
// ipv4, right ?
std::string flags;
if (m_flags == 0)
@@ -340,6 +372,7 @@
uint32_t
Ipv4Header::GetSerializedSize (void) const
{
+ NS_LOG_FUNCTION (this);
//return 5 * 4;
return m_headerSize;
}
@@ -347,6 +380,7 @@
void
Ipv4Header::Serialize (Buffer::Iterator start) const
{
+ NS_LOG_FUNCTION (this << &start);
Buffer::Iterator i = start;
uint8_t verIhl = (4 << 4) | (5);
@@ -386,6 +420,7 @@
uint32_t
Ipv4Header::Deserialize (Buffer::Iterator start)
{
+ NS_LOG_FUNCTION (this << &start);
Buffer::Iterator i = start;
uint8_t verIhl = i.ReadU8 ();
uint8_t ihl = verIhl & 0x0f;
--- a/src/internet/model/ipv4-interface-address.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-interface-address.cc Sat Apr 20 16:49:31 2013 +0200
@@ -37,7 +37,7 @@
: m_scope (GLOBAL),
m_secondary (false)
{
- NS_LOG_FUNCTION (this);
+ NS_LOG_FUNCTION (this << local << mask);
m_local = local;
m_mask = mask;
m_broadcast = Ipv4Address (local.Get () | (~mask.Get ()));
@@ -50,83 +50,83 @@
m_scope (o.m_scope),
m_secondary (o.m_secondary)
{
- NS_LOG_FUNCTION (this);
+ NS_LOG_FUNCTION (this << &o);
}
void
Ipv4InterfaceAddress::SetLocal (Ipv4Address local)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << local);
m_local = local;
}
Ipv4Address
Ipv4InterfaceAddress::GetLocal (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_local;
}
void
Ipv4InterfaceAddress::SetMask (Ipv4Mask mask)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << mask);
m_mask = mask;
}
Ipv4Mask
Ipv4InterfaceAddress::GetMask (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_mask;
}
void
Ipv4InterfaceAddress::SetBroadcast (Ipv4Address broadcast)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << broadcast);
m_broadcast = broadcast;
}
Ipv4Address
Ipv4InterfaceAddress::GetBroadcast (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_broadcast;
}
void
Ipv4InterfaceAddress::SetScope (Ipv4InterfaceAddress::InterfaceAddressScope_e scope)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << scope);
m_scope = scope;
}
Ipv4InterfaceAddress::InterfaceAddressScope_e
Ipv4InterfaceAddress::GetScope (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_scope;
}
bool
Ipv4InterfaceAddress::IsSecondary (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_secondary;
}
void
Ipv4InterfaceAddress::SetSecondary (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_secondary = true;
}
void
Ipv4InterfaceAddress::SetPrimary (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_secondary = false;
}
--- a/src/internet/model/ipv4-interface.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-interface.cc Sat Apr 20 16:49:31 2013 +0200
@@ -70,13 +70,13 @@
Ipv4Interface::~Ipv4Interface ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
void
Ipv4Interface::DoDispose (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_node = 0;
m_device = 0;
Object::DoDispose ();
@@ -85,6 +85,7 @@
void
Ipv4Interface::SetNode (Ptr<Node> node)
{
+ NS_LOG_FUNCTION (this << node);
m_node = node;
DoSetup ();
}
@@ -92,6 +93,7 @@
void
Ipv4Interface::SetDevice (Ptr<NetDevice> device)
{
+ NS_LOG_FUNCTION (this << device);
m_device = device;
DoSetup ();
}
@@ -99,6 +101,7 @@
void
Ipv4Interface::DoSetup (void)
{
+ NS_LOG_FUNCTION (this);
if (m_node == 0 || m_device == 0)
{
return;
@@ -114,32 +117,35 @@
Ptr<NetDevice>
Ipv4Interface::GetDevice (void) const
{
+ NS_LOG_FUNCTION (this);
return m_device;
}
void
Ipv4Interface::SetMetric (uint16_t metric)
{
- NS_LOG_FUNCTION (metric);
+ NS_LOG_FUNCTION (this << metric);
m_metric = metric;
}
uint16_t
Ipv4Interface::GetMetric (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_metric;
}
void
Ipv4Interface::SetArpCache (Ptr<ArpCache> a)
{
+ NS_LOG_FUNCTION (this << a);
m_cache = a;
}
Ptr<ArpCache>
Ipv4Interface::GetArpCache () const
{
+ NS_LOG_FUNCTION (this);
return m_cache;
}
@@ -151,49 +157,49 @@
bool
Ipv4Interface::IsUp (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_ifup;
}
bool
Ipv4Interface::IsDown (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return !m_ifup;
}
void
Ipv4Interface::SetUp (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_ifup = true;
}
void
Ipv4Interface::SetDown (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_ifup = false;
}
bool
Ipv4Interface::IsForwarding (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_forwarding;
}
void
Ipv4Interface::SetForwarding (bool val)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << val);
m_forwarding = val;
}
void
Ipv4Interface::Send (Ptr<Packet> p, Ipv4Address dest)
{
- NS_LOG_FUNCTION (dest << *p);
+ NS_LOG_FUNCTION (this << *p << dest);
if (!IsUp ())
{
return;
@@ -281,14 +287,14 @@
uint32_t
Ipv4Interface::GetNAddresses (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_ifaddrs.size ();
}
bool
Ipv4Interface::AddAddress (Ipv4InterfaceAddress addr)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << addr);
m_ifaddrs.push_back (addr);
return true;
}
@@ -296,7 +302,7 @@
Ipv4InterfaceAddress
Ipv4Interface::GetAddress (uint32_t index) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << index);
if (index < m_ifaddrs.size ())
{
uint32_t tmp = 0;
@@ -317,7 +323,7 @@
Ipv4InterfaceAddress
Ipv4Interface::RemoveAddress (uint32_t index)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << index);
if (index >= m_ifaddrs.size ())
{
NS_ASSERT_MSG (false, "Bug in Ipv4Interface::RemoveAddress");
--- a/src/internet/model/ipv4-l3-protocol.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-l3-protocol.cc Sat Apr 20 16:49:31 2013 +0200
@@ -104,11 +104,13 @@
void
Ipv4L3Protocol::Insert (Ptr<IpL4Protocol> protocol)
{
+ NS_LOG_FUNCTION (this << protocol);
m_protocols.push_back (protocol);
}
Ptr<IpL4Protocol>
Ipv4L3Protocol::GetProtocol (int protocolNumber) const
{
+ NS_LOG_FUNCTION (this << protocolNumber);
for (L4List_t::const_iterator i = m_protocols.begin (); i != m_protocols.end (); ++i)
{
if ((*i)->GetProtocolNumber () == protocolNumber)
@@ -121,12 +123,14 @@
void
Ipv4L3Protocol::Remove (Ptr<IpL4Protocol> protocol)
{
+ NS_LOG_FUNCTION (this << protocol);
m_protocols.remove (protocol);
}
void
Ipv4L3Protocol::SetNode (Ptr<Node> node)
{
+ NS_LOG_FUNCTION (this << node);
m_node = node;
// Add a LoopbackNetDevice if needed, and an Ipv4Interface on top of it
SetupLoopback ();
@@ -162,6 +166,7 @@
void
Ipv4L3Protocol::NotifyNewAggregate ()
{
+ NS_LOG_FUNCTION (this);
if (m_node == 0)
{
Ptr<Node>node = this->GetObject<Node>();
@@ -178,7 +183,7 @@
void
Ipv4L3Protocol::SetRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol)
{
- NS_LOG_FUNCTION (this);
+ NS_LOG_FUNCTION (this << routingProtocol);
m_routingProtocol = routingProtocol;
m_routingProtocol->SetIpv4 (this);
}
@@ -187,6 +192,7 @@
Ptr<Ipv4RoutingProtocol>
Ipv4L3Protocol::GetRoutingProtocol (void) const
{
+ NS_LOG_FUNCTION (this);
return m_routingProtocol;
}
@@ -266,6 +272,7 @@
void
Ipv4L3Protocol::SetDefaultTtl (uint8_t ttl)
{
+ NS_LOG_FUNCTION (this << static_cast<uint32_t> (ttl));
m_defaultTtl = ttl;
}
@@ -299,6 +306,7 @@
Ptr<Ipv4Interface>
Ipv4L3Protocol::GetInterface (uint32_t index) const
{
+ NS_LOG_FUNCTION (this << index);
if (index < m_interfaces.size ())
{
return m_interfaces[index];
@@ -309,6 +317,7 @@
uint32_t
Ipv4L3Protocol::GetNInterfaces (void) const
{
+ NS_LOG_FUNCTION (this);
return m_interfaces.size ();
}
@@ -316,6 +325,7 @@
Ipv4L3Protocol::GetInterfaceForAddress (
Ipv4Address address) const
{
+ NS_LOG_FUNCTION (this << address);
int32_t interface = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end ();
@@ -338,6 +348,7 @@
Ipv4Address address,
Ipv4Mask mask) const
{
+ NS_LOG_FUNCTION (this << address << mask);
int32_t interface = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end ();
@@ -359,6 +370,7 @@
Ipv4L3Protocol::GetInterfaceForDevice (
Ptr<const NetDevice> device) const
{
+ NS_LOG_FUNCTION (this << device);
int32_t interface = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end ();
@@ -376,6 +388,7 @@
bool
Ipv4L3Protocol::IsDestinationAddress (Ipv4Address address, uint32_t iif) const
{
+ NS_LOG_FUNCTION (this << address << iif);
// First check the incoming interface for a unicast address match
for (uint32_t i = 0; i < GetNAddresses (iif); i++)
{
@@ -439,7 +452,7 @@
Ipv4L3Protocol::Receive ( Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from,
const Address &to, NetDevice::PacketType packetType)
{
- NS_LOG_FUNCTION (this << device << p << protocol << from << to << packetType);
+ NS_LOG_FUNCTION (this << device << p << protocol << from << to << packetType);
NS_LOG_LOGIC ("Packet from " << from << " received on node " <<
m_node->GetId ());
@@ -514,6 +527,7 @@
Ptr<Icmpv4L4Protocol>
Ipv4L3Protocol::GetIcmp (void) const
{
+ NS_LOG_FUNCTION (this);
Ptr<IpL4Protocol> prot = GetProtocol (Icmpv4L4Protocol::GetStaticProtocolNumber ());
if (prot != 0)
{
@@ -528,6 +542,7 @@
bool
Ipv4L3Protocol::IsUnicast (Ipv4Address ad, Ipv4Mask interfaceMask) const
{
+ NS_LOG_FUNCTION (this << ad << interfaceMask);
return !ad.IsMulticast () && !ad.IsSubnetDirectedBroadcast (interfaceMask);
}
@@ -685,7 +700,7 @@
uint8_t tos,
bool mayFragment)
{
- NS_LOG_FUNCTION (this << source << destination << (uint16_t)protocol << payloadSize << (uint16_t)ttl << mayFragment);
+ NS_LOG_FUNCTION (this << source << destination << (uint16_t)protocol << payloadSize << (uint16_t)ttl << (uint16_t)tos << mayFragment);
Ipv4Header ipHeader;
ipHeader.SetSource (source);
ipHeader.SetDestination (destination);
@@ -718,7 +733,7 @@
Ptr<Packet> packet,
Ipv4Header const &ipHeader)
{
- NS_LOG_FUNCTION (this << packet << &ipHeader);
+ NS_LOG_FUNCTION (this << route << packet << &ipHeader);
if (route == 0)
{
NS_LOG_WARN ("No route to host. Drop.");
@@ -860,7 +875,7 @@
void
Ipv4L3Protocol::LocalDeliver (Ptr<const Packet> packet, Ipv4Header const&ip, uint32_t iif)
{
- NS_LOG_FUNCTION (this << packet << &ip);
+ NS_LOG_FUNCTION (this << packet << &ip << iif);
Ptr<Packet> p = packet->Copy (); // need to pass a non-const packet up
Ipv4Header ipHeader = ip;
@@ -934,6 +949,7 @@
Ipv4InterfaceAddress
Ipv4L3Protocol::GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const
{
+ NS_LOG_FUNCTION (this << interfaceIndex << addressIndex);
Ptr<Ipv4Interface> interface = GetInterface (interfaceIndex);
return interface->GetAddress (addressIndex);
}
@@ -941,6 +957,7 @@
uint32_t
Ipv4L3Protocol::GetNAddresses (uint32_t interface) const
{
+ NS_LOG_FUNCTION (this << interface);
Ptr<Ipv4Interface> iface = GetInterface (interface);
return iface->GetNAddresses ();
}
@@ -1026,6 +1043,7 @@
uint16_t
Ipv4L3Protocol::GetMetric (uint32_t i) const
{
+ NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetMetric ();
}
@@ -1033,6 +1051,7 @@
uint16_t
Ipv4L3Protocol::GetMtu (uint32_t i) const
{
+ NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetDevice ()->GetMtu ();
}
@@ -1040,6 +1059,7 @@
bool
Ipv4L3Protocol::IsUp (uint32_t i) const
{
+ NS_LOG_FUNCTION (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->IsUp ();
}
@@ -1090,6 +1110,7 @@
Ptr<NetDevice>
Ipv4L3Protocol::GetNetDevice (uint32_t i)
{
+ NS_LOG_FUNCTION (this << i);
return GetInterface (i)->GetDevice ();
}
@@ -1107,18 +1128,21 @@
bool
Ipv4L3Protocol::GetIpForward (void) const
{
+ NS_LOG_FUNCTION (this);
return m_ipForward;
}
void
Ipv4L3Protocol::SetWeakEsModel (bool model)
{
+ NS_LOG_FUNCTION (this << model);
m_weakEsModel = model;
}
bool
Ipv4L3Protocol::GetWeakEsModel (void) const
{
+ NS_LOG_FUNCTION (this);
return m_weakEsModel;
}
@@ -1138,7 +1162,7 @@
// If (when) IPv4 option headers will be implemented, the following code shall be changed.
// Of course also the reassemby code shall be changed as well.
- NS_LOG_FUNCTION (this << *packet << " - MTU: " << outIfaceMtu);
+ NS_LOG_FUNCTION (this << *packet << outIfaceMtu << &listFragments);
Ptr<Packet> p = packet->Copy ();
@@ -1226,7 +1250,7 @@
bool
Ipv4L3Protocol::ProcessFragment (Ptr<Packet>& packet, Ipv4Header& ipHeader, uint32_t iif)
{
- NS_LOG_FUNCTION (this << packet << " " << ipHeader << " " << iif);
+ NS_LOG_FUNCTION (this << packet << ipHeader << iif);
uint64_t addressCombination = uint64_t (ipHeader.GetSource ().Get ()) << 32 & uint64_t (ipHeader.GetDestination ().Get ());
uint32_t idProto = uint32_t (ipHeader.GetIdentification ()) << 16 & uint32_t (ipHeader.GetProtocol ());
@@ -1277,16 +1301,18 @@
Ipv4L3Protocol::Fragments::Fragments ()
: m_moreFragment (0)
{
+ NS_LOG_FUNCTION (this);
}
Ipv4L3Protocol::Fragments::~Fragments ()
{
+ NS_LOG_FUNCTION (this);
}
void
Ipv4L3Protocol::Fragments::AddFragment (Ptr<Packet> fragment, uint16_t fragmentOffset, bool moreFragment)
{
- NS_LOG_FUNCTION (this << fragment << " " << fragmentOffset << " " << moreFragment);
+ NS_LOG_FUNCTION (this << fragment << fragmentOffset << moreFragment);
std::list<std::pair<Ptr<Packet>, uint16_t> >::iterator it;
@@ -1376,6 +1402,8 @@
Ptr<Packet>
Ipv4L3Protocol::Fragments::GetPartialPacket () const
{
+ NS_LOG_FUNCTION (this);
+
std::list<std::pair<Ptr<Packet>, uint16_t> >::const_iterator it = m_fragments.begin ();
Ptr<Packet> p = Create<Packet> ();
@@ -1409,7 +1437,7 @@
void
Ipv4L3Protocol::HandleFragmentsTimeout (std::pair<uint64_t, uint32_t> key, Ipv4Header & ipHeader, uint32_t iif)
{
- NS_LOG_FUNCTION (this);
+ NS_LOG_FUNCTION (this << &key << &ipHeader << iif);
MapFragments_t::iterator it = m_fragments.find (key);
Ptr<Packet> packet = it->second->GetPartialPacket ();
--- a/src/internet/model/ipv4-list-routing.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-list-routing.cc Sat Apr 20 16:49:31 2013 +0200
@@ -44,18 +44,18 @@
Ipv4ListRouting::Ipv4ListRouting ()
: m_ipv4 (0)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
Ipv4ListRouting::~Ipv4ListRouting ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
void
Ipv4ListRouting::DoDispose (void)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
for (Ipv4RoutingProtocolList::iterator rprotoIter = m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end (); rprotoIter++)
{
@@ -71,6 +71,7 @@
void
Ipv4ListRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
+ NS_LOG_FUNCTION (this << stream);
*stream->GetStream () << "Node: " << m_ipv4->GetObject<Node> ()->GetId ()
<< " Time: " << Simulator::Now ().GetSeconds () << "s "
<< "Ipv4ListRouting table" << std::endl;
@@ -86,6 +87,7 @@
void
Ipv4ListRouting::DoInitialize (void)
{
+ NS_LOG_FUNCTION (this);
for (Ipv4RoutingProtocolList::iterator rprotoIter = m_routingProtocols.begin ();
rprotoIter != m_routingProtocols.end (); rprotoIter++)
{
@@ -99,7 +101,7 @@
Ptr<Ipv4Route>
Ipv4ListRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, enum Socket::SocketErrno &sockerr)
{
- NS_LOG_FUNCTION (this << header.GetDestination () << " " << header.GetSource () << " " << oif);
+ NS_LOG_FUNCTION (this << p << header.GetDestination () << header.GetSource () << oif << sockerr);
Ptr<Ipv4Route> route;
for (Ipv4RoutingProtocolList::const_iterator i = m_routingProtocols.begin ();
@@ -127,8 +129,8 @@
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb)
{
+ NS_LOG_FUNCTION (this << p << header << idev << &ucb << &mcb << &lcb << &ecb);
bool retVal = false;
- NS_LOG_FUNCTION (p << header << idev);
NS_LOG_LOGIC ("RouteInput logic for node: " << m_ipv4->GetObject<Node> ()->GetId ());
NS_ASSERT (m_ipv4 != 0);
@@ -268,7 +270,7 @@
Ptr<Ipv4RoutingProtocol>
Ipv4ListRouting::GetRoutingProtocol (uint32_t index, int16_t& priority) const
{
- NS_LOG_FUNCTION (index);
+ NS_LOG_FUNCTION (this << index << priority);
if (index > m_routingProtocols.size ())
{
NS_FATAL_ERROR ("Ipv4ListRouting::GetRoutingProtocol(): index " << index << " out of range");
@@ -289,6 +291,7 @@
bool
Ipv4ListRouting::Compare (const Ipv4RoutingProtocolEntry& a, const Ipv4RoutingProtocolEntry& b)
{
+ NS_LOG_FUNCTION_NOARGS ();
return a.first > b.first;
}
--- a/src/internet/model/ipv4-packet-info-tag.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-packet-info-tag.cc Sat Apr 20 16:49:31 2013 +0200
@@ -22,6 +22,9 @@
#include <stdint.h>
#include "ns3/ipv4-address.h"
#include "ipv4-packet-info-tag.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4PacketInfoTag");
namespace ns3 {
@@ -31,53 +34,62 @@
m_ifindex (0),
m_ttl (0)
{
+ NS_LOG_FUNCTION (this);
}
void
Ipv4PacketInfoTag::SetAddress (Ipv4Address addr)
{
+ NS_LOG_FUNCTION (this << addr);
m_addr = addr;
}
Ipv4Address
Ipv4PacketInfoTag::GetAddress (void) const
{
+ NS_LOG_FUNCTION (this);
return m_addr;
}
void
Ipv4PacketInfoTag::SetLocalAddress (Ipv4Address addr)
{
+ NS_LOG_FUNCTION (this << addr);
m_spec_dst = addr;
}
Ipv4Address
Ipv4PacketInfoTag::GetLocalAddress (void) const
{
+ NS_LOG_FUNCTION (this);
return m_spec_dst;
}
void
Ipv4PacketInfoTag::SetRecvIf (uint32_t ifindex)
{
+ NS_LOG_FUNCTION (this << ifindex);
m_ifindex = ifindex;
}
uint32_t
Ipv4PacketInfoTag::GetRecvIf (void) const
{
+ NS_LOG_FUNCTION (this);
return m_ifindex;
}
void
Ipv4PacketInfoTag::SetTtl (uint8_t ttl)
{
+ NS_LOG_FUNCTION (this << static_cast<uint32_t> (ttl));
m_ttl = ttl;
}
uint8_t
Ipv4PacketInfoTag::GetTtl (void) const
{
+ NS_LOG_FUNCTION (this);
return m_ttl;
}
@@ -95,19 +107,22 @@
TypeId
Ipv4PacketInfoTag::GetInstanceTypeId (void) const
{
+ NS_LOG_FUNCTION (this);
return GetTypeId ();
}
uint32_t
Ipv4PacketInfoTag::GetSerializedSize (void) const
{
+ NS_LOG_FUNCTION (this);
return 4 + 4
+ sizeof (uint32_t)
+ sizeof (uint8_t);
}
void
Ipv4PacketInfoTag::Serialize (TagBuffer i) const
-{
+{
+ NS_LOG_FUNCTION (this << &i);
uint8_t buf[4];
m_addr.Serialize (buf);
i.Write (buf, 4);
@@ -118,7 +133,8 @@
}
void
Ipv4PacketInfoTag::Deserialize (TagBuffer i)
-{
+{
+ NS_LOG_FUNCTION (this<< &i);
uint8_t buf[4];
i.Read (buf, 4);
m_addr = Ipv4Address::Deserialize (buf);
@@ -130,6 +146,7 @@
void
Ipv4PacketInfoTag::Print (std::ostream &os) const
{
+ NS_LOG_FUNCTION (this << &os);
os << "Ipv4 PKTINFO [DestAddr: " << m_addr;
os << ", Local Address:" << m_spec_dst;
os << ", RecvIf:" << (uint32_t) m_ifindex;
--- a/src/internet/model/ipv4-raw-socket-factory-impl.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-raw-socket-factory-impl.cc Sat Apr 20 16:49:31 2013 +0200
@@ -21,13 +21,16 @@
#include "ipv4-raw-socket-factory-impl.h"
#include "ipv4-l3-protocol.h"
#include "ns3/socket.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4RawSocketFactoryImpl");
namespace ns3 {
-
Ptr<Socket>
Ipv4RawSocketFactoryImpl::CreateSocket (void)
{
+ NS_LOG_FUNCTION (this);
Ptr<Ipv4> ipv4 = GetObject<Ipv4> ();
Ptr<Socket> socket = ipv4->CreateRawSocket ();
return socket;
--- a/src/internet/model/ipv4-raw-socket-factory.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-raw-socket-factory.cc Sat Apr 20 16:49:31 2013 +0200
@@ -19,6 +19,9 @@
*/
#include "ipv4-raw-socket-factory.h"
#include "ns3/uinteger.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4RawSocketFactory");
namespace ns3 {
--- a/src/internet/model/ipv4-raw-socket-impl.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-raw-socket-impl.cc Sat Apr 20 16:49:31 2013 +0200
@@ -65,6 +65,7 @@
void
Ipv4RawSocketImpl::SetNode (Ptr<Node> node)
{
+ NS_LOG_FUNCTION (this << node);
m_node = node;
}
@@ -86,6 +87,7 @@
enum Socket::SocketType
Ipv4RawSocketImpl::GetSocketType (void) const
{
+ NS_LOG_FUNCTION (this);
return NS3_SOCK_RAW;
}
@@ -118,11 +120,13 @@
int
Ipv4RawSocketImpl::Bind6 (void)
{
+ NS_LOG_FUNCTION (this);
return (-1);
}
int
Ipv4RawSocketImpl::GetSockName (Address &address) const
{
+ NS_LOG_FUNCTION (this << address);
address = InetSocketAddress (m_src, 0);
return 0;
}
@@ -362,6 +366,7 @@
bool
Ipv4RawSocketImpl::SetAllowBroadcast (bool allowBroadcast)
{
+ NS_LOG_FUNCTION (this << allowBroadcast);
if (!allowBroadcast)
{
return false;
@@ -372,6 +377,7 @@
bool
Ipv4RawSocketImpl::GetAllowBroadcast () const
{
+ NS_LOG_FUNCTION (this);
return true;
}
--- a/src/internet/model/ipv4-route.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-route.cc Sat Apr 20 16:49:31 2013 +0200
@@ -20,58 +20,70 @@
#include "ipv4-route.h"
#include "ns3/net-device.h"
#include "ns3/assert.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4Route");
namespace ns3 {
Ipv4Route::Ipv4Route ()
{
+ NS_LOG_FUNCTION (this);
}
void
Ipv4Route::SetDestination (Ipv4Address dest)
{
+ NS_LOG_FUNCTION (this << dest);
m_dest = dest;
}
Ipv4Address
Ipv4Route::GetDestination (void) const
{
+ NS_LOG_FUNCTION (this);
return m_dest;
}
void
Ipv4Route::SetSource (Ipv4Address src)
{
+ NS_LOG_FUNCTION (this << src);
m_source = src;
}
Ipv4Address
Ipv4Route::GetSource (void) const
{
+ NS_LOG_FUNCTION (this);
return m_source;
}
void
Ipv4Route::SetGateway (Ipv4Address gw)
{
+ NS_LOG_FUNCTION (this << gw);
m_gateway = gw;
}
Ipv4Address
Ipv4Route::GetGateway (void) const
{
+ NS_LOG_FUNCTION (this);
return m_gateway;
}
void
Ipv4Route::SetOutputDevice (Ptr<NetDevice> outputDevice)
{
+ NS_LOG_FUNCTION (this << outputDevice);
m_outputDevice = outputDevice;
}
Ptr<NetDevice>
Ipv4Route::GetOutputDevice (void) const
{
+ NS_LOG_FUNCTION (this);
return m_outputDevice;
}
@@ -83,48 +95,56 @@
Ipv4MulticastRoute::Ipv4MulticastRoute ()
{
+ NS_LOG_FUNCTION (this);
m_ttls.clear ();
}
void
Ipv4MulticastRoute::SetGroup (const Ipv4Address group)
{
+ NS_LOG_FUNCTION (this << group);
m_group = group;
}
Ipv4Address
Ipv4MulticastRoute::GetGroup (void) const
{
+ NS_LOG_FUNCTION (this);
return m_group;
}
void
Ipv4MulticastRoute::SetOrigin (const Ipv4Address origin)
{
+ NS_LOG_FUNCTION (this << origin);
m_origin = origin;
}
Ipv4Address
Ipv4MulticastRoute::GetOrigin (void) const
{
+ NS_LOG_FUNCTION (this);
return m_origin;
}
void
Ipv4MulticastRoute::SetParent (uint32_t parent)
{
+ NS_LOG_FUNCTION (this << parent);
m_parent = parent;
}
uint32_t
Ipv4MulticastRoute::GetParent (void) const
{
+ NS_LOG_FUNCTION (this);
return m_parent;
}
void
Ipv4MulticastRoute::SetOutputTtl (uint32_t oif, uint32_t ttl)
{
+ NS_LOG_FUNCTION (this << oif << ttl);
if (ttl >= MAX_TTL)
{
// This TTL value effectively disables the interface
@@ -144,6 +164,7 @@
uint32_t
Ipv4MulticastRoute::GetOutputTtl (uint32_t oif)
{
+ NS_LOG_FUNCTION (this << oif);
// We keep this interface around for compatibility (for now)
std::map<uint32_t, uint32_t>::const_iterator iter = m_ttls.find (oif);
if (iter == m_ttls.end ())
@@ -154,6 +175,7 @@
std::map<uint32_t, uint32_t>
Ipv4MulticastRoute::GetOutputTtlMap () const
{
+ NS_LOG_FUNCTION (this);
return(m_ttls);
}
--- a/src/internet/model/ipv4-routing-protocol.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-routing-protocol.cc Sat Apr 20 16:49:31 2013 +0200
@@ -19,6 +19,9 @@
#include "ns3/assert.h"
#include "ipv4-route.h"
#include "ipv4-routing-protocol.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4RoutingProtocol");
namespace ns3 {
--- a/src/internet/model/ipv4-routing-table-entry.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-routing-table-entry.cc Sat Apr 20 16:49:31 2013 +0200
@@ -20,6 +20,9 @@
#include "ipv4-routing-table-entry.h"
#include "ns3/assert.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4RoutingTableEntry");
namespace ns3 {
@@ -29,6 +32,7 @@
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry ()
{
+ NS_LOG_FUNCTION (this);
}
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const &route)
@@ -37,6 +41,7 @@
m_gateway (route.m_gateway),
m_interface (route.m_interface)
{
+ NS_LOG_FUNCTION (this << route);
}
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4RoutingTableEntry const *route)
@@ -45,6 +50,7 @@
m_gateway (route->m_gateway),
m_interface (route->m_interface)
{
+ NS_LOG_FUNCTION (this << route);
}
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address dest,
@@ -73,6 +79,7 @@
m_gateway (gateway),
m_interface (interface)
{
+ NS_LOG_FUNCTION (this << network << networkMask << gateway << interface);
}
Ipv4RoutingTableEntry::Ipv4RoutingTableEntry (Ipv4Address network,
Ipv4Mask networkMask,
@@ -82,11 +89,13 @@
m_gateway (Ipv4Address::GetZero ()),
m_interface (interface)
{
+ NS_LOG_FUNCTION (this << network << networkMask << interface);
}
bool
Ipv4RoutingTableEntry::IsHost (void) const
{
+ NS_LOG_FUNCTION (this);
if (m_destNetworkMask.IsEqual (Ipv4Mask::GetOnes ()))
{
return true;
@@ -99,16 +108,19 @@
Ipv4Address
Ipv4RoutingTableEntry::GetDest (void) const
{
+ NS_LOG_FUNCTION (this);
return m_dest;
}
bool
Ipv4RoutingTableEntry::IsNetwork (void) const
{
+ NS_LOG_FUNCTION (this);
return !IsHost ();
}
bool
Ipv4RoutingTableEntry::IsDefault (void) const
{
+ NS_LOG_FUNCTION (this);
if (m_dest.IsEqual (Ipv4Address::GetZero ()))
{
return true;
@@ -121,16 +133,19 @@
Ipv4Address
Ipv4RoutingTableEntry::GetDestNetwork (void) const
{
+ NS_LOG_FUNCTION (this);
return m_dest;
}
Ipv4Mask
Ipv4RoutingTableEntry::GetDestNetworkMask (void) const
{
+ NS_LOG_FUNCTION (this);
return m_destNetworkMask;
}
bool
Ipv4RoutingTableEntry::IsGateway (void) const
{
+ NS_LOG_FUNCTION (this);
if (m_gateway.IsEqual (Ipv4Address::GetZero ()))
{
return false;
@@ -143,11 +158,13 @@
Ipv4Address
Ipv4RoutingTableEntry::GetGateway (void) const
{
+ NS_LOG_FUNCTION (this);
return m_gateway;
}
uint32_t
Ipv4RoutingTableEntry::GetInterface (void) const
{
+ NS_LOG_FUNCTION (this);
return m_interface;
}
@@ -156,12 +173,14 @@
Ipv4Address nextHop,
uint32_t interface)
{
+ NS_LOG_FUNCTION_NOARGS ();
return Ipv4RoutingTableEntry (dest, nextHop, interface);
}
Ipv4RoutingTableEntry
Ipv4RoutingTableEntry::CreateHostRouteTo (Ipv4Address dest,
uint32_t interface)
{
+ NS_LOG_FUNCTION_NOARGS ();
return Ipv4RoutingTableEntry (dest, interface);
}
Ipv4RoutingTableEntry
@@ -170,6 +189,7 @@
Ipv4Address nextHop,
uint32_t interface)
{
+ NS_LOG_FUNCTION_NOARGS ();
return Ipv4RoutingTableEntry (network, networkMask,
nextHop, interface);
}
@@ -178,6 +198,7 @@
Ipv4Mask networkMask,
uint32_t interface)
{
+ NS_LOG_FUNCTION_NOARGS ();
return Ipv4RoutingTableEntry (network, networkMask,
interface);
}
@@ -185,6 +206,7 @@
Ipv4RoutingTableEntry::CreateDefaultRoute (Ipv4Address nextHop,
uint32_t interface)
{
+ NS_LOG_FUNCTION_NOARGS ();
return Ipv4RoutingTableEntry (Ipv4Address::GetZero (), nextHop, interface);
}
@@ -239,6 +261,7 @@
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry ()
{
+ NS_LOG_FUNCTION (this);
}
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const &route)
@@ -248,6 +271,7 @@
m_inputInterface (route.m_inputInterface),
m_outputInterfaces (route.m_outputInterfaces)
{
+ NS_LOG_FUNCTION (this << route);
}
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (Ipv4MulticastRoutingTableEntry const *route)
@@ -257,6 +281,7 @@
m_inputInterface (route->m_inputInterface),
m_outputInterfaces (route->m_outputInterfaces)
{
+ NS_LOG_FUNCTION (this << route);
}
Ipv4MulticastRoutingTableEntry::Ipv4MulticastRoutingTableEntry (
@@ -265,6 +290,7 @@
uint32_t inputInterface,
std::vector<uint32_t> outputInterfaces)
{
+ NS_LOG_FUNCTION (this << origin << group << inputInterface << &outputInterfaces);
m_origin = origin;
m_group = group;
m_inputInterface = inputInterface;
@@ -274,30 +300,35 @@
Ipv4Address
Ipv4MulticastRoutingTableEntry::GetOrigin (void) const
{
+ NS_LOG_FUNCTION (this);
return m_origin;
}
Ipv4Address
Ipv4MulticastRoutingTableEntry::GetGroup (void) const
{
+ NS_LOG_FUNCTION (this);
return m_group;
}
uint32_t
Ipv4MulticastRoutingTableEntry::GetInputInterface (void) const
{
+ NS_LOG_FUNCTION (this);
return m_inputInterface;
}
uint32_t
Ipv4MulticastRoutingTableEntry::GetNOutputInterfaces (void) const
{
+ NS_LOG_FUNCTION (this);
return m_outputInterfaces.size ();
}
uint32_t
Ipv4MulticastRoutingTableEntry::GetOutputInterface (uint32_t n) const
{
+ NS_LOG_FUNCTION (this << n);
NS_ASSERT_MSG (n < m_outputInterfaces.size (),
"Ipv4MulticastRoutingTableEntry::GetOutputInterface (): index out of bounds");
@@ -307,6 +338,7 @@
std::vector<uint32_t>
Ipv4MulticastRoutingTableEntry::GetOutputInterfaces (void) const
{
+ NS_LOG_FUNCTION (this);
return m_outputInterfaces;
}
@@ -317,6 +349,7 @@
uint32_t inputInterface,
std::vector<uint32_t> outputInterfaces)
{
+ NS_LOG_FUNCTION_NOARGS ();
return Ipv4MulticastRoutingTableEntry (origin, group, inputInterface, outputInterfaces);
}
--- a/src/internet/model/ipv4-static-routing.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4-static-routing.cc Sat Apr 20 16:49:31 2013 +0200
@@ -34,7 +34,7 @@
#include "ipv4-static-routing.h"
#include "ipv4-routing-table-entry.h"
-NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRouting");
+NS_LOG_COMPONENT_DEFINE ("Ipv4StaticRoung");
using std::make_pair;
@@ -122,7 +122,7 @@
uint32_t inputInterface,
std::vector<uint32_t> outputInterfaces)
{
- NS_LOG_FUNCTION (this << origin << " " << group << " " << inputInterface);
+ NS_LOG_FUNCTION (this << origin << " " << group << " " << inputInterface << " " << &outputInterfaces);
Ipv4MulticastRoutingTableEntry *route = new Ipv4MulticastRoutingTableEntry ();
*route = Ipv4MulticastRoutingTableEntry::CreateMulticastRoute (origin, group,
inputInterface, outputInterfaces);
@@ -454,7 +454,7 @@
Ptr<Ipv4Route>
Ipv4StaticRouting::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
{
- NS_LOG_FUNCTION (this << header << oif);
+ NS_LOG_FUNCTION (this << p<< header << oif << sockerr);
Ipv4Address destination = header.GetDestination ();
Ptr<Ipv4Route> rtentry = 0;
@@ -486,7 +486,7 @@
UnicastForwardCallback ucb, MulticastForwardCallback mcb,
LocalDeliverCallback lcb, ErrorCallback ecb)
{
- NS_LOG_FUNCTION (this << p << ipHeader << ipHeader.GetSource () << ipHeader.GetDestination () << idev);
+ NS_LOG_FUNCTION (this << p << ipHeader << ipHeader.GetSource () << ipHeader.GetDestination () << idev << &ucb << &mcb << &lcb << &ecb);
NS_ASSERT (m_ipv4 != 0);
// Check if input device supports IP
@@ -579,11 +579,13 @@
Ipv4StaticRouting::~Ipv4StaticRouting ()
{
+ NS_LOG_FUNCTION (this);
}
void
Ipv4StaticRouting::DoDispose (void)
{
+ NS_LOG_FUNCTION (this);
for (NetworkRoutesI j = m_networkRoutes.begin ();
j != m_networkRoutes.end ();
j = m_networkRoutes.erase (j))
@@ -704,6 +706,7 @@
void
Ipv4StaticRouting::PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const
{
+ NS_LOG_FUNCTION (this << stream);
std::ostream* os = stream->GetStream ();
if (GetNRoutes () > 0)
{
--- a/src/internet/model/ipv4.cc Sat Apr 20 14:57:59 2013 +0200
+++ b/src/internet/model/ipv4.cc Sat Apr 20 16:49:31 2013 +0200
@@ -22,6 +22,9 @@
#include "ns3/node.h"
#include "ns3/boolean.h"
#include "ipv4.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("Ipv4");
namespace ns3 {
@@ -56,10 +59,12 @@
Ipv4::Ipv4 ()
{
+ NS_LOG_FUNCTION (this);
}
Ipv4::~Ipv4 ()
{
+ NS_LOG_FUNCTION (this);
}
} // namespace ns3