--- a/src/node/net-device.cc Thu Sep 13 17:47:42 2007 -0700
+++ b/src/node/net-device.cc Thu Sep 13 21:36:32 2007 -0700
@@ -22,15 +22,13 @@
#include <iostream>
#include "ns3/assert.h"
#include "ns3/object.h"
-#include "ns3/debug.h"
+#include "ns3/log.h"
#include "ns3/trace-resolver.h"
-
-
#include "channel.h"
#include "net-device.h"
#include "node.h"
-NS_DEBUG_COMPONENT_DEFINE ("NetDevice");
+NS_LOG_COMPONENT_DEFINE ("NetDevice");
namespace ns3 {
@@ -47,22 +45,27 @@
m_isMulticast (false),
m_isPointToPoint (false)
{
+ NS_LOG_FUNCTION;
SetInterfaceId (NetDevice::iid);
m_node->AddDevice (this);
}
NetDevice::~NetDevice ()
-{}
+{
+ NS_LOG_FUNCTION;
+}
Address
NetDevice::GetAddress (void) const
{
+ NS_LOG_FUNCTION;
return m_address;
}
bool
NetDevice::SetMtu (const uint16_t mtu)
{
+ NS_LOG_FUNCTION;
m_mtu = mtu;
return true;
}
@@ -70,54 +73,63 @@
uint16_t
NetDevice::GetMtu (void) const
{
+ NS_LOG_FUNCTION;
return m_mtu;
}
void
NetDevice::SetName(const std::string name)
{
+ NS_LOG_FUNCTION;
m_name = name;
}
std::string
NetDevice::GetName(void) const
{
+ NS_LOG_FUNCTION;
return m_name;
}
void
NetDevice::SetIfIndex(uint32_t index)
{
+ NS_LOG_FUNCTION;
m_ifIndex = index;
}
uint32_t
NetDevice::GetIfIndex(void) const
{
+ NS_LOG_FUNCTION;
return m_ifIndex;
}
bool
NetDevice::IsLinkUp (void) const
{
+ NS_LOG_FUNCTION;
return m_isUp;
}
void
NetDevice::SetLinkChangeCallback (Callback<void> callback)
{
+ NS_LOG_FUNCTION;
m_linkChangeCallback = callback;
}
bool
NetDevice::IsBroadcast (void) const
{
+ NS_LOG_FUNCTION;
return m_isBroadcast;
}
Address const &
NetDevice::GetBroadcast (void) const
{
+ NS_LOG_FUNCTION;
NS_ASSERT (m_isBroadcast);
return m_broadcast;
}
@@ -125,6 +137,7 @@
void
NetDevice::EnableBroadcast (Address broadcast)
{
+ NS_LOG_FUNCTION;
m_isBroadcast = true;
m_broadcast = broadcast;
}
@@ -132,18 +145,21 @@
void
NetDevice::DisableBroadcast (void)
{
+ NS_LOG_FUNCTION;
m_isBroadcast = false;
}
bool
NetDevice::IsMulticast (void) const
{
+ NS_LOG_FUNCTION;
return m_isMulticast;
}
Address
NetDevice::GetMulticast (void) const
{
+ NS_LOG_FUNCTION;
NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): "
"Invalid operation when not IsMulticast ()");
return m_multicast;
@@ -152,6 +168,7 @@
Address
NetDevice::MakeMulticastAddress(Ipv4Address multicastGroup) const
{
+ NS_LOG_FUNCTION;
NS_ASSERT_MSG (m_isMulticast, "NetDevice::GetMulticast (): "
"Invalid operation when not IsMulticast ()");
return m_multicast;
@@ -160,6 +177,7 @@
void
NetDevice::EnableMulticast (Address multicast)
{
+ NS_LOG_FUNCTION;
m_isMulticast = true;
m_multicast = multicast;
}
@@ -167,24 +185,28 @@
void
NetDevice::DisableMulticast (void)
{
+ NS_LOG_FUNCTION;
m_isMulticast = false;
}
bool
NetDevice::IsPointToPoint (void) const
{
+ NS_LOG_FUNCTION;
return m_isPointToPoint;
}
void
NetDevice::EnablePointToPoint (void)
{
+ NS_LOG_FUNCTION;
m_isPointToPoint = true;
}
void
NetDevice::DisablePointToPoint (void)
{
+ NS_LOG_FUNCTION;
m_isPointToPoint = false;
}
@@ -192,6 +214,7 @@
bool
NetDevice::Send(const Packet& p, const Address& dest, uint16_t protocolNumber)
{
+ NS_LOG_FUNCTION;
if (m_isUp)
{
return SendTo(p, dest, protocolNumber);
@@ -205,6 +228,7 @@
Ptr<Channel>
NetDevice::GetChannel (void) const
{
+ NS_LOG_FUNCTION;
return DoGetChannel ();
}
@@ -212,10 +236,10 @@
bool
NetDevice::ForwardUp(const Packet& p, uint16_t param, const Address &from)
{
+ NS_LOG_FUNCTION;
bool retval = false;
- NS_DEBUG ("NetDevice::ForwardUp: UID is " << p.GetUid()
- << " device is: " << GetName());
+ NS_LOG_LOGIC ("UID is " << p.GetUid() << " device is: " << GetName());
if (!m_receiveCallback.IsNull ())
{
@@ -223,7 +247,7 @@
}
else
{
- NS_DEBUG ("NetDevice::Receive call back is NULL");
+ NS_LOG_WARN ("NetDevice::Receive call back is NULL");
}
return retval;
@@ -232,6 +256,7 @@
void
NetDevice::NotifyLinkUp (void)
{
+ NS_LOG_FUNCTION;
m_isUp = true;
if (!m_linkChangeCallback.IsNull ())
{
@@ -242,6 +267,7 @@
void
NetDevice::NotifyLinkDown (void)
{
+ NS_LOG_FUNCTION;
m_isUp = false;
if (!m_linkChangeCallback.IsNull ())
{
@@ -252,24 +278,28 @@
Ptr<Node>
NetDevice::GetNode (void) const
{
+ NS_LOG_FUNCTION;
return m_node;
}
bool
NetDevice::NeedsArp (void) const
{
+ NS_LOG_FUNCTION;
return DoNeedsArp ();
}
void
NetDevice::SetReceiveCallback (ReceiveCallback cb)
{
+ NS_LOG_FUNCTION;
m_receiveCallback = cb;
}
void
NetDevice::DoDispose()
{
+ NS_LOG_FUNCTION;
m_node = 0;
}