nicer logging of parameters (bug 79 patch from Gustavo)

This commit is contained in:
Tom Henderson
2007-11-14 21:59:14 -08:00
parent a53e880346
commit 2e68155c6d
25 changed files with 240 additions and 148 deletions

View File

@@ -73,7 +73,7 @@ FakeInternetNode::Doit (void)
FakeInternetNode::UpperDoSendUp (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
NS_LOG_INFO ("**** Receive inbound packet");
m_dtqInbound.Enqueue(p);
return m_dtqInbound.Dequeue(p);
@@ -83,7 +83,7 @@ FakeInternetNode::UpperDoSendUp (Packet &p)
FakeInternetNode::UpperDoPull (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
return m_dtqOutbound.Dequeue(p);
}
@@ -142,7 +142,7 @@ FakePhysicalLayer::LowerDoNotify (LayerConnectorUpper *upper)
FakePhysicalLayer::UpperDoSendUp (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
NS_ASSERT(m_upperPartner);
return m_upperPartner->UpperSendUp(p);
@@ -152,7 +152,7 @@ FakePhysicalLayer::UpperDoSendUp (Packet &p)
FakePhysicalLayer::UpperDoPull (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
return m_dtqOutbound.Dequeue(p);
}

View File

@@ -109,7 +109,7 @@ void
OnOffApplication::SetMaxBytes(uint32_t maxBytes)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << maxBytes << ")");
NS_LOG_PARAMS (this << maxBytes);
m_maxBytes = maxBytes;
}
@@ -117,7 +117,7 @@ void
OnOffApplication::SetDefaultRate (const DataRate &rate)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &rate << ")");
NS_LOG_PARAMS (&rate);
g_defaultRate.SetValue (rate);
}
@@ -125,7 +125,7 @@ void
OnOffApplication::SetDefaultSize (uint32_t size)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << size << ")");
NS_LOG_PARAMS (size);
g_defaultSize.SetValue (size);
}

View File

@@ -40,9 +40,8 @@ UdpEchoClient::UdpEchoClient (
Application(n)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << n << ", " << serverAddress <<
", " << serverPort << ", " << count << ", " << interval <<
", " << size << ")");
NS_LOG_PARAMS (this << n << serverAddress << serverPort << count
<< interval << size);
Construct (n, serverAddress, serverPort, count, interval, size);
}
@@ -62,9 +61,8 @@ UdpEchoClient::Construct (
uint32_t size)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << n << ", " << serverAddress <<
", " << serverPort << ", " << count << ", " << interval <<
", " << size << ")");
NS_LOG_PARAMS (this << n << serverAddress << serverPort
<< count << interval << size);
m_node = n;
m_serverAddress = serverAddress;
@@ -154,7 +152,7 @@ UdpEchoClient::Receive(
const Address &from)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << socket << ", " << packet << ", " << from << ")");
NS_LOG_PARAMS (this << socket << packet << from);
if (InetSocketAddress::IsMatchingType (from))
{

View File

@@ -38,7 +38,7 @@ UdpEchoServer::UdpEchoServer (
Application(n)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << n << ", " << port << ")");
NS_LOG_PARAMS (this << n << port);
Construct (n, port);
}
@@ -54,7 +54,7 @@ UdpEchoServer::Construct (
uint16_t port)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << n << ", " << port << ")");
NS_LOG_PARAMS (this << n << port);
m_node = n;
m_port = port;
@@ -106,7 +106,7 @@ UdpEchoServer::Receive(
const Address &from)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << socket << ", " << packet << ", " << from << ")");
NS_LOG_PARAMS (this << socket << packet << from);
if (InetSocketAddress::IsMatchingType (from))
{

View File

@@ -703,7 +703,7 @@ PacketMetadata::DoAddHeader (uint32_t uid, uint32_t size)
m_metadataSkipped = true;
return;
}
NS_LOG_PARAM ("(uid=" << uid << ", size=" << size << ")");
NS_LOG_PARAMS ("(uid=" << uid << ", size=" << size << ")");
struct PacketMetadata::SmallItem item;
item.next = m_head;
@@ -723,7 +723,7 @@ PacketMetadata::DoRemoveHeader (uint32_t uid, uint32_t size)
m_metadataSkipped = true;
return;
}
NS_LOG_PARAM ("(uid=" << uid << ", size=" << size << ")");
NS_LOG_PARAMS ("(uid=" << uid << ", size=" << size << ")");
struct PacketMetadata::SmallItem item;
struct PacketMetadata::ExtraItem extraItem;
uint32_t read = ReadItems (m_head, &item, &extraItem);

View File

@@ -341,6 +341,11 @@ LogComponentPrintList (void)
}
}
ParameterLogger g_parameterLogger;
EndParameterListStruct EndParameterList;
} // namespace ns3
#endif // NS3_LOG_ENABLE

View File

@@ -75,6 +75,7 @@
#endif
/**
* \ingroup logging
* \param msg message to output
@@ -88,6 +89,84 @@
#ifdef NS3_LOG_ENABLE
namespace ns3 {
struct EndParameterListStruct {};
extern EndParameterListStruct EndParameterList;
struct ParameterName
{
const char *name;
ParameterName (const char *name_) : name (name_) {}
};
class ParameterLogger : public std::ostream
{
int m_itemNumber;
const char *m_parameterName;
public:
ParameterLogger ()
: m_itemNumber (0)
{}
template<typename T>
ParameterLogger& operator<< (T param)
{
switch (m_itemNumber)
{
case 0: // first item is actually the function name
if (m_parameterName)
{
std::clog << m_parameterName << "=" << param;
m_parameterName = 0;
}
else
{
std::clog << param;
}
break;
case 1:
if (m_parameterName)
{
std::clog << ", " << m_parameterName << "=" << param;
m_parameterName = 0;
}
else
{
std::clog << ", " << param;
}
break;
default: // parameter following a previous parameter
std::clog << ", " << param;
break;
}
m_itemNumber++;
return *this;
}
ParameterLogger&
operator << (ParameterName paramName)
{
m_parameterName = paramName.name;
return *this;
}
ParameterLogger&
operator << (EndParameterListStruct dummy)
{
std::clog << ")" << std::endl;
m_itemNumber = 0;
return *this;
}
};
extern ParameterLogger g_parameterLogger;
}
/**
* \param level the log level
* \param msg the message to log
@@ -142,8 +221,33 @@
#define NS_LOG_FUNCTION \
NS_LOG_F(ns3::LOG_FUNCTION)
#define NS_LOG_PARAM(msg) \
NS_LOG(ns3::LOG_PARAM, msg)
#define NS_LOG_PARAMS(parameters) \
do \
{ \
if (g_log.IsEnabled (ns3::LOG_PARAM)) \
{ \
g_parameterLogger << __PRETTY_FUNCTION__ \
<< parameters \
<< EndParameterList; \
} \
} \
while (false)
#define NS_LOG_PARAMS_BEGIN() \
if (g_log.IsEnabled (ns3::LOG_PARAM)) \
{ \
g_parameterLogger << __PRETTY_FUNCTION__;
#define NS_LOG_PARAM(param) \
g_parameterLogger << ParameterName (#param) << param;
#define NS_LOG_PARAMS_END() \
g_parameterLogger << EndParameterList; \
}
#define NS_LOG_LOGIC(msg) \
NS_LOG(ns3::LOG_LOGIC, msg)

View File

@@ -68,8 +68,7 @@ CsmaChannel::CsmaChannel(
m_delay (delay)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << Channel::GetName() << ", " << bps.GetBitRate() <<
", " << delay << ")");
NS_LOG_PARAMS (this << Channel::GetName() << bps.GetBitRate() << delay);
Init();
}
@@ -83,8 +82,7 @@ CsmaChannel::CsmaChannel(
m_delay (delay)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << name << ", " << bps.GetBitRate() << ", " << delay <<
")");
NS_LOG_PARAMS (this << name << bps.GetBitRate() << delay);
Init();
}
@@ -97,7 +95,7 @@ int32_t
CsmaChannel::Attach(Ptr<CsmaNetDevice> device)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << device << ")");
NS_LOG_PARAMS (this << device);
NS_ASSERT(device != 0);
CsmaDeviceRec rec(device);
@@ -110,7 +108,7 @@ bool
CsmaChannel::Reattach(Ptr<CsmaNetDevice> device)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << device << ")");
NS_LOG_PARAMS (this << device);
NS_ASSERT(device != 0);
std::vector<CsmaDeviceRec>::iterator it;
@@ -136,7 +134,7 @@ bool
CsmaChannel::Reattach(uint32_t deviceId)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << deviceId << ")");
NS_LOG_PARAMS (this << deviceId);
if (deviceId < m_deviceList.size())
{
@@ -158,7 +156,7 @@ bool
CsmaChannel::Detach(uint32_t deviceId)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << deviceId << ")");
NS_LOG_PARAMS (this << deviceId);
if (deviceId < m_deviceList.size())
{
@@ -189,7 +187,7 @@ bool
CsmaChannel::Detach(Ptr<CsmaNetDevice> device)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << device << ")");
NS_LOG_PARAMS (this << device);
NS_ASSERT(device != 0);
std::vector<CsmaDeviceRec>::iterator it;
@@ -208,7 +206,7 @@ bool
CsmaChannel::TransmitStart(Packet& p, uint32_t srcId)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ", " << srcId << ")");
NS_LOG_PARAMS (this << &p << srcId);
NS_LOG_INFO ("UID is " << p.GetUid () << ")");
if (m_state != IDLE)
@@ -240,7 +238,7 @@ bool
CsmaChannel::TransmitEnd()
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &m_currentPkt << ", " << m_currentSrc << ")");
NS_LOG_PARAMS (this << &m_currentPkt << m_currentSrc);
NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")");
NS_ASSERT(m_state == TRANSMITTING);
@@ -266,7 +264,7 @@ void
CsmaChannel::PropagationCompleteEvent()
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &m_currentPkt << ")");
NS_LOG_PARAMS (this << &m_currentPkt);
NS_LOG_INFO ("UID is " << m_currentPkt.GetUid () << ")");
NS_ASSERT(m_state == PROPAGATING);

View File

@@ -87,7 +87,7 @@ CsmaNetDevice::CsmaNetDevice (Ptr<Node> node)
m_receiveErrorModel (0)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << node << ")");
NS_LOG_PARAMS (this << node);
m_encapMode = IP_ARP;
Init(true, true);
}
@@ -99,7 +99,7 @@ CsmaNetDevice::CsmaNetDevice (Ptr<Node> node, Mac48Address addr,
m_receiveErrorModel (0)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << node << ")");
NS_LOG_PARAMS (this << node);
m_encapMode = encapMode;
Init(true, true);
@@ -112,7 +112,7 @@ CsmaNetDevice::CsmaNetDevice (Ptr<Node> node, Mac48Address addr,
m_bps (DataRate (0xffffffff))
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << node << ")");
NS_LOG_PARAMS (this << node);
m_encapMode = encapMode;
Init(sendEnable, receiveEnable);
@@ -145,7 +145,7 @@ CsmaNetDevice&
CsmaNetDevice::operator= (const CsmaNetDevice nd)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &nd << ")");
NS_LOG_PARAMS (this << &nd);
return *this;
}
*/
@@ -513,7 +513,7 @@ bool
CsmaNetDevice::Attach (Ptr<CsmaChannel> ch)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &ch << ")");
NS_LOG_PARAMS (this << &ch);
m_channel = ch;
@@ -532,7 +532,7 @@ void
CsmaNetDevice::AddQueue (Ptr<Queue> q)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << q << ")");
NS_LOG_PARAMS (this << q);
m_queue = q;
}
@@ -649,7 +649,7 @@ Address
CsmaNetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << multicastGroup << ")");
NS_LOG_PARAMS (this << multicastGroup);
//
// First, get the generic multicast address.
//

View File

@@ -52,8 +52,7 @@ PointToPointChannel::PointToPointChannel(
m_nDevices(0)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << Channel::GetName() << ", " << bps.GetBitRate() <<
", " << delay << ")");
NS_LOG_PARAMS (this << Channel::GetName() << bps.GetBitRate() << delay);
}
PointToPointChannel::PointToPointChannel(
@@ -67,15 +66,14 @@ PointToPointChannel::PointToPointChannel(
m_nDevices(0)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << name << ", " << bps.GetBitRate() << ", " <<
delay << ")");
NS_LOG_PARAMS (this << name << bps.GetBitRate() << delay);
}
void
PointToPointChannel::Attach(Ptr<PointToPointNetDevice> device)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << device << ")");
NS_LOG_PARAMS (this << device);
NS_ASSERT(m_nDevices < N_DEVICES && "Only two devices permitted");
NS_ASSERT(device != 0);
@@ -99,7 +97,7 @@ PointToPointChannel::TransmitStart(Packet& p,
const Time& txTime)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ", " << src << ")");
NS_LOG_PARAMS (this << &p << src);
NS_LOG_LOGIC ("UID is " << p.GetUid () << ")");
NS_ASSERT(m_link[0].m_state != INITIALIZING);

View File

@@ -99,7 +99,7 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr<Node> node,
m_receiveErrorModel (0)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << node << ")");
NS_LOG_PARAMS (this << node);
//
// XXX BUGBUG
//
@@ -201,7 +201,7 @@ bool PointToPointNetDevice::SendTo (const Packet& packet, const Address& dest,
PointToPointNetDevice::TransmitStart (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
NS_LOG_LOGIC ("UID is " << p.GetUid () << ")");
//
// This function is called to start the process of transmitting a packet.
@@ -262,7 +262,7 @@ bool
PointToPointNetDevice::Attach (Ptr<PointToPointChannel> ch)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &ch << ")");
NS_LOG_PARAMS (this << &ch);
m_channel = ch;
@@ -289,7 +289,7 @@ PointToPointNetDevice::Attach (Ptr<PointToPointChannel> ch)
void PointToPointNetDevice::AddQueue (Ptr<Queue> q)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << q << ")");
NS_LOG_PARAMS (this << q);
m_queue = q;
}
@@ -306,7 +306,7 @@ void PointToPointNetDevice::AddReceiveErrorModel (Ptr<ErrorModel> em)
void PointToPointNetDevice::Receive (Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
uint16_t protocol = 0;
Packet packet = p;

View File

@@ -64,7 +64,7 @@ void
ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ", " << dest << ")");
NS_LOG_PARAMS (this << &p << dest);
NS_ASSERT (GetDevice () != 0);
if (GetDevice ()->NeedsArp ())

View File

@@ -93,7 +93,7 @@ Ipv4EndPoint *
Ipv4EndPointDemux::Allocate (Ipv4Address address)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << this << ", " << address << ")");
NS_LOG_PARAMS (this << address);
uint16_t port = AllocateEphemeralPort ();
if (port == 0)
{
@@ -117,7 +117,7 @@ Ipv4EndPoint *
Ipv4EndPointDemux::Allocate (Ipv4Address address, uint16_t port)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << this << ", " << address << ", " << port << ")");
NS_LOG_PARAMS (this << address << port);
if (LookupLocal (address, port))
{
NS_LOG_WARN ("Duplicate address/port; failing.");
@@ -134,10 +134,7 @@ Ipv4EndPointDemux::Allocate (Ipv4Address localAddress, uint16_t localPort,
Ipv4Address peerAddress, uint16_t peerPort)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(localAddress=" << localAddress
<< ", localPort=" << localPort
<< ", peerAddress=" << peerAddress
<< ", peerPort=" << peerPort << ")");
NS_LOG_PARAMS (this << localAddress << localPort << peerAddress << peerPort);
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
{
if ((*i)->GetLocalPort () == localPort &&
@@ -189,8 +186,15 @@ Ipv4EndPointDemux::Lookup (Ipv4Address daddr, uint16_t dport,
Ipv4EndPoint *generic = 0;
EndPoints retval;
NS_LOG_PARAM ("(daddr=" << daddr << ", dport=" << dport
<< ", saddr=" << saddr << ", sport=" << sport << ")");
//NS_LOG_PARAMS (this << daddr << dport << saddr << sport);
NS_LOG_PARAMS_BEGIN ();
NS_LOG_PARAM (this);
NS_LOG_PARAM (daddr);
NS_LOG_PARAM (dport);
NS_LOG_PARAM (saddr);
NS_LOG_PARAM (sport);
NS_LOG_PARAM (incomingInterface);
NS_LOG_PARAMS_END ();
for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++)
{

View File

@@ -41,7 +41,7 @@ Ipv4Interface::Ipv4Interface (Ptr<NetDevice> nd)
m_metric(1)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &nd << ")");
NS_LOG_PARAMS (this << &nd);
}
Ipv4Interface::~Ipv4Interface ()
@@ -68,7 +68,7 @@ void
Ipv4Interface::SetAddress (Ipv4Address a)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << a << ")");
NS_LOG_PARAMS (this << a);
m_address = a;
}
@@ -76,7 +76,7 @@ void
Ipv4Interface::SetNetworkMask (Ipv4Mask mask)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << mask << ")");
NS_LOG_PARAMS (this << mask);
m_netmask = mask;
}
@@ -101,7 +101,7 @@ void
Ipv4Interface::SetMetric (uint16_t metric)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << metric << ")");
NS_LOG_PARAMS ("(" << metric << ")");
m_metric = metric;
}

View File

@@ -233,7 +233,7 @@ Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest,
uint32_t interface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << dest << ", " << nextHop << ", " << interface << ")");
NS_LOG_PARAMS (this << dest << nextHop << interface);
m_staticRouting->AddHostRouteTo (dest, nextHop, interface);
}
@@ -242,7 +242,7 @@ Ipv4L3Protocol::AddHostRouteTo (Ipv4Address dest,
uint32_t interface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << dest << ", " << interface << ")");
NS_LOG_PARAMS (this << dest << interface);
m_staticRouting->AddHostRouteTo (dest, interface);
}
@@ -253,8 +253,7 @@ Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network,
uint32_t interface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << network << ", " << networkMask << ", " << nextHop <<
", " << interface << ")");
NS_LOG_PARAMS (this << network << networkMask << nextHop << interface);
m_staticRouting->AddNetworkRouteTo (network, networkMask, nextHop, interface);
}
@@ -264,8 +263,7 @@ Ipv4L3Protocol::AddNetworkRouteTo (Ipv4Address network,
uint32_t interface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << network << ", " << networkMask << ", " << interface <<
")");
NS_LOG_PARAMS (this << network << networkMask << interface);
m_staticRouting->AddNetworkRouteTo (network, networkMask, interface);
}
@@ -274,7 +272,7 @@ Ipv4L3Protocol::SetDefaultRoute (Ipv4Address nextHop,
uint32_t interface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << nextHop << ", " << interface << ")");
NS_LOG_PARAMS (this << nextHop << interface);
m_staticRouting->SetDefaultRoute (nextHop, interface);
}
@@ -285,7 +283,7 @@ Ipv4L3Protocol::Lookup (
Ipv4RoutingProtocol::RouteReplyCallback routeReply)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &ipHeader << ", " << &packet << &routeReply << ")");
NS_LOG_PARAMS (this << &ipHeader << &packet << &routeReply);
Lookup (Ipv4RoutingProtocol::IF_INDEX_ANY, ipHeader, packet, routeReply);
}
@@ -298,8 +296,7 @@ Ipv4L3Protocol::Lookup (
Ipv4RoutingProtocol::RouteReplyCallback routeReply)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << ifIndex << ", " << &ipHeader << ", " << &packet <<
&routeReply << ")");
NS_LOG_PARAMS (this << ifIndex << &ipHeader << &packet << &routeReply);
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
m_routingProtocols.begin ();
@@ -348,7 +345,7 @@ Ipv4L3Protocol::AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol,
int priority)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &routingProtocol << ", " << priority << ")");
NS_LOG_PARAMS (this << &routingProtocol << priority);
m_routingProtocols.push_back
(std::pair<int, Ptr<Ipv4RoutingProtocol> > (-priority, routingProtocol));
m_routingProtocols.sort ();
@@ -372,7 +369,7 @@ void
Ipv4L3Protocol::RemoveRoute (uint32_t index)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM("(" << index << ")");
NS_LOG_PARAMS (this << index);
m_staticRouting->RemoveRoute (index);
}
@@ -383,8 +380,7 @@ Ipv4L3Protocol::AddMulticastRoute (Ipv4Address origin,
std::vector<uint32_t> outputInterfaces)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << origin << ", " << group << ", " << inputInterface <<
", " << &outputInterfaces << ")");
NS_LOG_PARAMS (this << origin << group << inputInterface << &outputInterfaces);
m_staticRouting->AddMulticastRoute (origin, group, inputInterface,
outputInterfaces);
@@ -394,7 +390,7 @@ void
Ipv4L3Protocol::SetDefaultMulticastRoute (uint32_t outputInterface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << outputInterface << ")");
NS_LOG_PARAMS (this << outputInterface);
m_staticRouting->SetDefaultMulticastRoute (outputInterface);
}
@@ -410,7 +406,7 @@ Ipv4MulticastRoute *
Ipv4L3Protocol::GetMulticastRoute (uint32_t index) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << index << ")");
NS_LOG_PARAMS (this << index);
return m_staticRouting->GetMulticastRoute (index);
}
@@ -420,8 +416,7 @@ Ipv4L3Protocol::RemoveMulticastRoute (Ipv4Address origin,
uint32_t inputInterface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << origin << ", " << group << ", " << inputInterface <<
")");
NS_LOG_PARAMS (this << origin << group << inputInterface);
m_staticRouting->RemoveMulticastRoute (origin, group, inputInterface);
}
@@ -429,7 +424,7 @@ void
Ipv4L3Protocol::RemoveMulticastRoute (uint32_t index)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << index << ")");
NS_LOG_PARAMS (this << index);
m_staticRouting->RemoveMulticastRoute (index);
}
@@ -437,7 +432,7 @@ uint32_t
Ipv4L3Protocol::AddInterface (Ptr<NetDevice> device)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &device << ")");
NS_LOG_PARAMS (this << &device);
Ptr<Ipv4Interface> interface = Create<ArpIpv4Interface> (m_node, device);
return AddIpv4Interface (interface);
}
@@ -446,7 +441,7 @@ uint32_t
Ipv4L3Protocol::AddIpv4Interface (Ptr<Ipv4Interface>interface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << interface << ")");
NS_LOG_PARAMS (this << interface);
uint32_t index = m_nInterfaces;
m_interfaces.push_back (interface);
m_nInterfaces++;
@@ -457,7 +452,7 @@ Ptr<Ipv4Interface>
Ipv4L3Protocol::GetInterface (uint32_t index) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << index << ")");
NS_LOG_PARAMS (this << index);
uint32_t tmp = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
{
@@ -481,7 +476,7 @@ uint32_t
Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << addr << ")");
NS_LOG_PARAMS (this << addr);
uint32_t ifIndex = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
@@ -503,7 +498,7 @@ uint32_t
Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << addr << ", " << mask << ")");
NS_LOG_PARAMS (this << addr << mask);
uint32_t ifIndex = 0;
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
@@ -525,7 +520,7 @@ Ptr<Ipv4Interface>
Ipv4L3Protocol::FindInterfaceForDevice (Ptr<const NetDevice> device)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &device << ")");
NS_LOG_PARAMS (this << &device);
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); i != m_interfaces.end (); i++)
{
if ((*i)->GetDevice () == device)
@@ -540,8 +535,7 @@ void
Ipv4L3Protocol::Receive( Ptr<NetDevice> device, const Packet& p, uint16_t protocol, const Address &from)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &device << ", " << &p << ", " << protocol << ", " <<
from << ")");
NS_LOG_PARAMS (this << &device << &p << protocol << from);
NS_LOG_LOGIC ("Packet from " << from);
@@ -585,8 +579,7 @@ Ipv4L3Protocol::Send (Packet const &packet,
uint8_t protocol)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &packet << ", " << source << ", " << ", " <<
destination << ", " << protocol << ")");
NS_LOG_PARAMS (this << &packet << source << destination << protocol);
Ipv4Header ipHeader;
@@ -637,8 +630,7 @@ Ipv4L3Protocol::SendRealOut (bool found,
Ipv4Header const &ipHeader)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << found << ", " << &route << ", " << &packet <<
&ipHeader << ")");
NS_LOG_PARAMS (this << found << &route << &packet << &ipHeader);
if (!found)
{
@@ -673,8 +665,7 @@ Ipv4L3Protocol::Forwarding (
Ptr<NetDevice> device)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << ifIndex << ", " << &packet << ", " << &ipHeader <<
", " << device << ")");
NS_LOG_PARAMS (ifIndex << &packet << &ipHeader<< device);
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
i != m_interfaces.end (); i++)
@@ -751,7 +742,7 @@ Ipv4L3Protocol::ForwardUp (Packet p, Ipv4Header const&ip,
Ptr<Ipv4Interface> incomingInterface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ", " << &ip << ")");
NS_LOG_PARAMS (this << &p << &ip);
Ptr<Ipv4L4Demux> demux = m_node->QueryInterface<Ipv4L4Demux> (Ipv4L4Demux::iid);
Ptr<Ipv4L4Protocol> protocol = demux->GetProtocol (ip.GetProtocol ());
@@ -762,7 +753,7 @@ void
Ipv4L3Protocol::JoinMulticastGroup (Ipv4Address origin, Ipv4Address group)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << origin << ", " << group << ")");
NS_LOG_PARAMS (this << origin << group);
m_multicastGroups.push_back(
std::pair<Ipv4Address, Ipv4Address> (origin, group));
}
@@ -771,7 +762,7 @@ void
Ipv4L3Protocol::LeaveMulticastGroup (Ipv4Address origin, Ipv4Address group)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << origin << ", " << group << ")");
NS_LOG_PARAMS (this << origin << group);
for (Ipv4MulticastGroupList::iterator i = m_multicastGroups.begin ();
i != m_multicastGroups.end ();
@@ -789,7 +780,7 @@ void
Ipv4L3Protocol::SetAddress (uint32_t i, Ipv4Address address)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ", " << address << ")");
NS_LOG_PARAMS (this << i << address);
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetAddress (address);
}
@@ -798,7 +789,7 @@ void
Ipv4L3Protocol::SetNetworkMask (uint32_t i, Ipv4Mask mask)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ", " << mask << ")");
NS_LOG_PARAMS (this << i << mask);
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetNetworkMask (mask);
}
@@ -807,7 +798,7 @@ Ipv4Mask
Ipv4L3Protocol::GetNetworkMask (uint32_t i) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ")");
NS_LOG_PARAMS (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetNetworkMask ();
}
@@ -816,7 +807,7 @@ Ipv4Address
Ipv4L3Protocol::GetAddress (uint32_t i) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ")");
NS_LOG_PARAMS (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetAddress ();
}
@@ -825,7 +816,7 @@ void
Ipv4L3Protocol::SetMetric (uint32_t i, uint16_t metric)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ", " << metric << ")");
NS_LOG_PARAMS ("(" << i << ", " << metric << ")");
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetMetric (metric);
}
@@ -834,7 +825,7 @@ uint16_t
Ipv4L3Protocol::GetMetric (uint32_t i) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ")");
NS_LOG_PARAMS ("(" << i << ")");
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetMetric ();
}
@@ -844,7 +835,7 @@ Ipv4L3Protocol::GetIfIndexForDestination (
Ipv4Address destination, uint32_t& ifIndex) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << destination << ", " << &ifIndex << ")");
NS_LOG_PARAMS (this << destination << &ifIndex);
//
// The first thing we do in trying to determine a source address is to
// consult the routing protocols. These will also check for a default route
@@ -911,7 +902,7 @@ uint16_t
Ipv4L3Protocol::GetMtu (uint32_t i) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ")");
NS_LOG_PARAMS (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->GetMtu ();
}
@@ -920,7 +911,7 @@ bool
Ipv4L3Protocol::IsUp (uint32_t i) const
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ")");
NS_LOG_PARAMS (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
return interface->IsUp ();
}
@@ -929,7 +920,7 @@ void
Ipv4L3Protocol::SetUp (uint32_t i)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << i << ")");
NS_LOG_PARAMS (this << i);
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetUp ();
@@ -948,7 +939,7 @@ void
Ipv4L3Protocol::SetDown (uint32_t ifaceIndex)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << ifaceIndex << ")");
NS_LOG_PARAMS (this << ifaceIndex);
Ptr<Ipv4Interface> interface = GetInterface (ifaceIndex);
interface->SetDown ();

View File

@@ -47,7 +47,7 @@ void
Ipv4LoopbackInterface::SendTo (Packet packet, Ipv4Address dest)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &packet << ", " << dest << ")");
NS_LOG_PARAMS (this << &packet << dest);
Ptr<Ipv4L3Protocol> ipv4 =
m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);

View File

@@ -522,8 +522,7 @@ Ipv4StaticRouting::RequestRoute (
RouteReplyCallback routeReply)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << ifIndex << &ipHeader << ", " << &packet << ", " <<
&routeReply << ")");
NS_LOG_PARAMS (this << ifIndex << &ipHeader << &packet << &routeReply);
NS_LOG_LOGIC ("source = " << ipHeader.GetSource ());
@@ -576,7 +575,7 @@ bool
Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << destination << ", " << &ifIndex << ")");
NS_LOG_PARAMS (this << destination << &ifIndex);
//
// 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.

View File

@@ -83,7 +83,7 @@ Ipv4EndPoint *
UdpL4Protocol::Allocate (Ipv4Address address)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << address << ")");
NS_LOG_PARAMS (this << address);
return m_endPoints->Allocate (address);
}
@@ -91,7 +91,7 @@ Ipv4EndPoint *
UdpL4Protocol::Allocate (uint16_t port)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << port << ")");
NS_LOG_PARAMS (this << port);
return m_endPoints->Allocate (port);
}
@@ -99,7 +99,7 @@ Ipv4EndPoint *
UdpL4Protocol::Allocate (Ipv4Address address, uint16_t port)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << address << ", " << port << ")");
NS_LOG_PARAMS (this << address << port);
return m_endPoints->Allocate (address, port);
}
Ipv4EndPoint *
@@ -107,8 +107,7 @@ UdpL4Protocol::Allocate (Ipv4Address localAddress, uint16_t localPort,
Ipv4Address peerAddress, uint16_t peerPort)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << localAddress << ", " << localPort << ", " <<
peerAddress << ", " << peerPort << ")");
NS_LOG_PARAMS (this << localAddress << localPort << peerAddress << peerPort);
return m_endPoints->Allocate (localAddress, localPort,
peerAddress, peerPort);
}
@@ -117,7 +116,7 @@ void
UdpL4Protocol::DeAllocate (Ipv4EndPoint *endPoint)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << endPoint << ")");
NS_LOG_PARAMS (this << endPoint);
m_endPoints->DeAllocate (endPoint);
}
@@ -128,8 +127,7 @@ UdpL4Protocol::Receive(Packet& packet,
Ptr<Ipv4Interface> interface)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &packet << ", " << source << ", " << destination <<
")");
NS_LOG_PARAMS (this << &packet << source << destination);
UdpHeader udpHeader;
packet.RemoveHeader (udpHeader);
@@ -149,8 +147,7 @@ UdpL4Protocol::Send (Packet packet,
uint16_t sport, uint16_t dport)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &packet << ", " << saddr << ", " << daddr << ", " <<
sport << ", " << dport << ")");
NS_LOG_PARAMS (this << &packet << saddr << daddr << sport << dport);
UdpHeader udpHeader;
udpHeader.SetDestination (dport);

View File

@@ -117,7 +117,7 @@ int
UdpSocket::Bind (const Address &address)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM("(" << address << ")");
NS_LOG_PARAMS (this << address);
if (!InetSocketAddress::IsMatchingType (address))
{
@@ -175,7 +175,7 @@ int
UdpSocket::Connect(const Address & address)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << address << ")");
NS_LOG_PARAMS (this << address);
Ipv4Route routeToDest;
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
m_defaultAddress = transport.GetIpv4 ();
@@ -190,7 +190,7 @@ int
UdpSocket::Send (const Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
if (!m_connected)
{
@@ -226,7 +226,7 @@ int
UdpSocket::DoSendTo (const Packet &p, const Address &address)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ", " << address << ")");
NS_LOG_PARAMS (this << &p << address);
if (!m_connected)
{
@@ -248,7 +248,7 @@ int
UdpSocket::DoSendTo (const Packet &p, Ipv4Address dest, uint16_t port)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ", " << dest << ", " << port << ")");
NS_LOG_PARAMS (this << &p << dest << port);
Ipv4Route routeToDest;
@@ -308,7 +308,7 @@ int
UdpSocket::SendTo(const Address &address, const Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << address << ", " << &p << ")");
NS_LOG_PARAMS (this << address << &p);
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address);
Ipv4Address ipv4 = transport.GetIpv4 ();
uint16_t port = transport.GetPort ();
@@ -319,7 +319,7 @@ void
UdpSocket::ForwardUp (const Packet &packet, Ipv4Address ipv4, uint16_t port)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &packet << ", " << ipv4 << ", " << port << ")");
NS_LOG_PARAMS (this << &packet << ipv4 << port);
if (m_shutdownRecv)
{

View File

@@ -37,7 +37,7 @@ Channel::Channel (std::string name)
: m_name(name)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << name << ")");
NS_LOG_PARAMS (this << name);
SetInterfaceId (Channel::iid);
}
@@ -50,7 +50,7 @@ Channel::~Channel ()
Channel::SetName(std::string name)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << name << ")");
NS_LOG_PARAMS (this << name);
m_name = name;
}

View File

@@ -45,7 +45,7 @@ void
DropTailQueue::SetMaxPackets (uint32_t npackets)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << npackets << ")");
NS_LOG_PARAMS (this << npackets);
m_maxPackets = npackets;
}
@@ -61,7 +61,7 @@ bool
DropTailQueue::DoEnqueue (const Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
if (m_packets.size () >= m_maxPackets)
{
@@ -78,7 +78,7 @@ bool
DropTailQueue::DoDequeue (Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
if (m_packets.empty())
{
@@ -98,7 +98,7 @@ bool
DropTailQueue::DoPeek (Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
if (m_packets.empty())
{

View File

@@ -139,7 +139,7 @@ bool
Queue::Enqueue (const Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
NS_LOG_LOGIC ("m_traceEnqueue (p)");
m_traceEnqueue (p);
@@ -157,7 +157,7 @@ bool
Queue::Dequeue (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
bool retval = DoDequeue (p);
@@ -189,7 +189,7 @@ bool
Queue::Peek (Packet &p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
return DoPeek (p);
}
@@ -264,7 +264,7 @@ void
Queue::Drop (const Packet& p)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << &p << ")");
NS_LOG_PARAMS (this << &p);
m_nTotalDroppedPackets++;
m_nTotalDroppedBytes += p.GetSize ();

View File

@@ -52,7 +52,7 @@ CandidateQueue::Clear (void)
CandidateQueue::Push (SPFVertex *vNew)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << vNew << ")");
NS_LOG_PARAMS (this << vNew);
CandidateList_t::iterator i = m_candidates.begin ();

View File

@@ -975,7 +975,7 @@ GlobalRouteManagerImpl::DebugSPFCalculate (Ipv4Address root)
GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << root << ")");
NS_LOG_PARAMS (this << root);
SPFVertex *v;
//

View File

@@ -58,8 +58,7 @@ GlobalRoutingLinkRecord::GlobalRoutingLinkRecord (
m_metric (metric)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << linkType << ", " << linkId << ", " << linkData <<
", " << metric << ")");
NS_LOG_PARAMS (this << linkType << linkId << linkData << metric);
}
GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord ()
@@ -157,8 +156,7 @@ GlobalRoutingLSA::GlobalRoutingLSA (
m_status(status)
{
NS_LOG_FUNCTION;
NS_LOG_PARAM ("(" << status << ", " << linkStateId << ", " <<
advertisingRtr << ")");
NS_LOG_PARAMS (this << status << linkStateId << advertisingRtr);
}
GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa)