--- a/src/node/arp-cache.cc Fri Feb 16 09:56:21 2007 +0100
+++ b/src/node/arp-cache.cc Fri Feb 16 10:04:02 2007 +0100
@@ -26,17 +26,6 @@
#include "arp-cache.h"
#include "arp-header.h"
-#ifdef TRACE_ARP
-#include <iostream>
-#include "simulator.h"
-# define TRACE(x) \
-std::cout << "ARP TRACE " << Simulator::Now () << " " \
- << x << std::endl;
-#else /* TRACE_ARP */
-# define TRACE(format,...)
-#endif /* TRACE_ARP */
-
-
namespace ns3 {
ArpCache::ArpCache (NetDevice *device, Ipv4Interface *interface)
--- a/src/node/arp.cc Fri Feb 16 09:56:21 2007 +0100
+++ b/src/node/arp.cc Fri Feb 16 10:04:02 2007 +0100
@@ -19,6 +19,7 @@
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#include "ns3/packet.h"
+#include "ns3/debug.h"
#include "arp.h"
#include "arp-header.h"
#include "arp-cache.h"
@@ -27,7 +28,7 @@
#include "node.h"
#include "ipv4.h"
-#define TRACE(x)
+NS_DEBUG_COMPONENT_DEFINE ("Arp");
namespace ns3 {
@@ -77,7 +78,7 @@
if (arp.IsRequest () &&
arp.GetDestinationIpv4Address () == cache->GetInterface ()->GetAddress ())
{
- TRACE ("got request from " << arp.GetSourceIpv4Address () << " -- send reply");
+ NS_DEBUG ("got request from " << arp.GetSourceIpv4Address () << " -- send reply");
SendArpReply (cache, arp.GetSourceIpv4Address (),
arp.GetSourceHardwareAddress ());
}
@@ -91,7 +92,7 @@
{
if (entry->IsWaitReply ())
{
- TRACE ("got reply from " << arp.GetSourceIpv4Address ()
+ NS_DEBUG ("got reply from " << arp.GetSourceIpv4Address ()
<< " for waiting entry -- flush");
MacAddress from_mac = arp.GetSourceHardwareAddress ();
Packet waiting = entry->MarkAlive (from_mac);
@@ -101,14 +102,14 @@
{
// ignore this reply which might well be an attempt
// at poisening my arp cache.
- TRACE ("got reply from " << arp.GetSourceIpv4Address () <<
+ NS_DEBUG ("got reply from " << arp.GetSourceIpv4Address () <<
" for non-waiting entry -- drop");
// XXX report packet as dropped.
}
}
else
{
- TRACE ("got reply for unknown entry -- drop");
+ NS_DEBUG ("got reply for unknown entry -- drop");
// XXX report packet as dropped.
}
}
@@ -126,19 +127,19 @@
{
if (entry->IsDead ())
{
- TRACE ("dead entry for " << destination << " expired -- send arp request");
+ NS_DEBUG ("dead entry for " << destination << " expired -- send arp request");
entry->MarkWaitReply (packet);
SendArpRequest (cache, destination);
}
else if (entry->IsAlive ())
{
- TRACE ("alive entry for " << destination << " expired -- send arp request");
+ NS_DEBUG ("alive entry for " << destination << " expired -- send arp request");
entry->MarkWaitReply (packet);
SendArpRequest (cache, destination);
}
else if (entry->IsWaitReply ())
{
- TRACE ("wait reply for " << destination << " expired -- drop");
+ NS_DEBUG ("wait reply for " << destination << " expired -- drop");
entry->MarkDead ();
// XXX report packet as 'dropped'
}
@@ -147,18 +148,18 @@
{
if (entry->IsDead ())
{
- TRACE ("dead entry for " << destination << " valid -- drop");
+ NS_DEBUG ("dead entry for " << destination << " valid -- drop");
// XXX report packet as 'dropped'
}
else if (entry->IsAlive ())
{
- TRACE ("alive entry for " << destination << " valid -- send");
+ NS_DEBUG ("alive entry for " << destination << " valid -- send");
*hardwareDestination = entry->GetMacAddress ();
return true;
}
else if (entry->IsWaitReply ())
{
- TRACE ("wait reply for " << destination << " valid -- drop previous");
+ NS_DEBUG ("wait reply for " << destination << " valid -- drop previous");
Packet old = entry->UpdateWaitReply (packet);
// XXX report 'old' packet as 'dropped'
}
@@ -168,7 +169,7 @@
else
{
// This is our first attempt to transmit data to this destination.
- TRACE ("no entry for " << destination << " -- send arp request");
+ NS_DEBUG ("no entry for " << destination << " -- send arp request");
entry = cache->Add (destination);
entry->MarkWaitReply (packet);
SendArpRequest (cache, destination);
--- a/src/node/ipv4-header.cc Fri Feb 16 09:56:21 2007 +0100
+++ b/src/node/ipv4-header.cc Fri Feb 16 10:04:02 2007 +0100
@@ -20,19 +20,11 @@
*/
#include "ns3/assert.h"
+#include "ns3/debug.h"
#include "ns3/header.h"
#include "ipv4-header.h"
-#define TRACE_CHUNK_IPV4 1
-
-#ifdef TRACE_CHUNK_IPV4
-#include <iostream>
-#include "ns3/simulator.h"
-# define TRACE(x) \
-std::cout << "CHUNK IPV4 TRACE " << Simulator::Now () << " " << x << std::endl;
-#else /* TRACE_CHUNK_IPV4 */
-# define TRACE(format,...)
-#endif /* TRACE_CHUNK_IPV4 */
+NS_DEBUG_COMPONENT_DEFINE ("Ipv4Header");
namespace ns3 {
@@ -225,7 +217,6 @@
{
Buffer::Iterator i = start;
- //TRACE ("init ipv4 current="<<buffer->GetCurrent ());
uint8_t verIhl = (4 << 4) | (5);
i.WriteU8 (verIhl);
i.WriteU8 (m_tos);
@@ -255,10 +246,9 @@
#if 0
// XXX we need to add Buffer::Iterator::PeekData method
uint8_t *data = start.PeekData ();
- //TRACE ("fini ipv4 current="<<state->GetCurrent ());
uint16_t checksum = UtilsChecksumCalculate (0, data, GetSize ());
checksum = UtilsChecksumComplete (checksum);
- //TRACE ("checksum=" <<checksum);
+ NS_DEBUG ("checksum=" <<checksum);
i = start;
i.Next (10);
i.WriteU16 (checksum);
@@ -301,7 +291,6 @@
{
#if 0
uint8_t *data = start.PeekData ();
- //TRACE ("fini ipv4 current="<<state->GetCurrent ());
uint16_t localChecksum = UtilsChecksumCalculate (0, data, headerSize);
if (localChecksum == 0xffff)
{
--- a/src/node/ipv4.cc Fri Feb 16 09:56:21 2007 +0100
+++ b/src/node/ipv4.cc Fri Feb 16 10:04:02 2007 +0100
@@ -20,6 +20,7 @@
//
#include "ns3/packet.h"
+#include "ns3/debug.h"
#include "ipv4.h"
#include "ipv4-l4-protocol.h"
@@ -31,7 +32,7 @@
#include "node.h"
#include "ipv4-l4-demux.h"
-#define TRACE(x)
+NS_DEBUG_COMPONENT_DEFINE ("Ipv4");
namespace ns3 {
@@ -352,7 +353,7 @@
Ipv4Route *route = Lookup (ipHeader.GetDestination ());
if (route == 0)
{
- TRACE ("not for me -- forwarding but no route to host. drop.");
+ NS_DEBUG ("not for me -- forwarding but no route to host. drop.");
return;
}
@@ -386,7 +387,7 @@
{
if ((*i)->GetAddress ().IsEqual (ipHeader.GetDestination ()))
{
- TRACE ("for me 1");
+ NS_DEBUG ("for me 1");
return false;
}
}
@@ -399,7 +400,7 @@
{
if (ipHeader.GetDestination ().IsEqual (interface->GetBroadcast ()))
{
- TRACE ("for me 2");
+ NS_DEBUG ("for me 2");
return false;
}
break;
@@ -408,29 +409,29 @@
if (ipHeader.GetDestination ().IsEqual (Ipv4Address::GetBroadcast ()))
{
- TRACE ("for me 3");
+ NS_DEBUG ("for me 3");
return false;
}
if (ipHeader.GetDestination ().IsEqual (Ipv4Address::GetAny ()))
{
- TRACE ("for me 4");
+ NS_DEBUG ("for me 4");
return false;
}
if (ipHeader.GetTtl () == 1)
{
// Should send ttl expired here
// XXX
- TRACE ("not for me -- ttl expired. drop.");
+ NS_DEBUG ("not for me -- ttl expired. drop.");
return true;
}
ipHeader.SetTtl (ipHeader.GetTtl () - 1);
Ipv4Route *route = Lookup (ipHeader.GetDestination ());
if (route == 0)
{
- TRACE ("not for me -- forwarding but no route to host. drop.");
+ NS_DEBUG ("not for me -- forwarding but no route to host. drop.");
return true;
}
- TRACE ("not for me -- forwarding.");
+ NS_DEBUG ("not for me -- forwarding.");
SendRealOut (packet, ipHeader, *route);
return true;
}
--- a/src/node/llc-snap-header.cc Fri Feb 16 09:56:21 2007 +0100
+++ b/src/node/llc-snap-header.cc Fri Feb 16 10:04:02 2007 +0100
@@ -23,18 +23,6 @@
#include "llc-snap-header.h"
-#define noTRACE_LLC_SNAP_HEADER 1
-
-#ifdef TRACE_LLC_SNAP_HEADER
-#include <iostream>
-#include "ns3/simulator.h"
-# define TRACE(x) \
-std::cout << "LLCSNAP HEAD TRACE " << Simulator::Now () << " " << x << std::endl;
-#else /* TRACE_LLC_SNAP_HEADER */
-# define TRACE(format,...)
-#endif /* TRACE_LLC_SNAP_HEADER */
-
-
namespace ns3 {
LlcSnapHeader::LlcSnapHeader ()