--- a/src/internet/model/global-route-manager-impl.cc Fri Apr 19 22:39:55 2013 +0200
+++ b/src/internet/model/global-route-manager-impl.cc Sat Apr 20 00:29:36 2013 +0200
@@ -40,7 +40,7 @@
#include "candidate-queue.h"
#include "ipv4-global-routing.h"
-NS_LOG_COMPONENT_DEFINE ("GlobalRouteManager");
+NS_LOG_COMPONENT_DEFINE ("GlobalRouteManagerImpl");
namespace ns3 {
@@ -89,7 +89,7 @@
m_children (),
m_vertexProcessed (false)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
SPFVertex::SPFVertex (GlobalRoutingLSA* lsa) :
@@ -102,7 +102,7 @@
m_children (),
m_vertexProcessed (false)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << lsa);
if (lsa->GetLSType () == GlobalRoutingLSA::RouterLSA)
{
@@ -118,7 +118,7 @@
SPFVertex::~SPFVertex ()
{
- NS_LOG_FUNCTION (m_vertexId);
+ NS_LOG_FUNCTION (this);
NS_LOG_LOGIC ("Children vertices - " << m_children);
NS_LOG_LOGIC ("Parent verteices - " << m_parents);
@@ -170,63 +170,63 @@
void
SPFVertex::SetVertexType (SPFVertex::VertexType type)
{
- NS_LOG_FUNCTION (type);
+ NS_LOG_FUNCTION (this << type);
m_vertexType = type;
}
SPFVertex::VertexType
SPFVertex::GetVertexType (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_vertexType;
}
void
SPFVertex::SetVertexId (Ipv4Address id)
{
- NS_LOG_FUNCTION (id);
+ NS_LOG_FUNCTION (this << id);
m_vertexId = id;
}
Ipv4Address
SPFVertex::GetVertexId (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_vertexId;
}
void
SPFVertex::SetLSA (GlobalRoutingLSA* lsa)
{
- NS_LOG_FUNCTION (lsa);
+ NS_LOG_FUNCTION (this << lsa);
m_lsa = lsa;
}
GlobalRoutingLSA*
SPFVertex::GetLSA (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_lsa;
}
void
SPFVertex::SetDistanceFromRoot (uint32_t distance)
{
- NS_LOG_FUNCTION (distance);
+ NS_LOG_FUNCTION (this << distance);
m_distanceFromRoot = distance;
}
uint32_t
SPFVertex::GetDistanceFromRoot (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_distanceFromRoot;
}
void
SPFVertex::SetParent (SPFVertex* parent)
{
- NS_LOG_FUNCTION (parent);
+ NS_LOG_FUNCTION (this << parent);
// always maintain only one parent when using setter/getter methods
m_parents.clear ();
@@ -236,7 +236,7 @@
SPFVertex*
SPFVertex::GetParent (uint32_t i) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << i);
// If the index i is out-of-range, return 0 and do nothing
if (m_parents.size () <= i)
@@ -255,7 +255,7 @@
void
SPFVertex::MergeParent (const SPFVertex* v)
{
- NS_LOG_FUNCTION (v);
+ NS_LOG_FUNCTION (this << v);
NS_LOG_LOGIC ("Before merge, list of parents = " << m_parents);
// combine the two lists first, and then remove any duplicated after
@@ -270,7 +270,7 @@
void
SPFVertex::SetRootExitDirection (Ipv4Address nextHop, int32_t id)
{
- NS_LOG_FUNCTION (nextHop << id);
+ NS_LOG_FUNCTION (this << nextHop << id);
// always maintain only one root's exit
m_ecmpRootExits.clear ();
@@ -284,14 +284,14 @@
void
SPFVertex::SetRootExitDirection (SPFVertex::NodeExit_t exit)
{
- NS_LOG_FUNCTION (exit);
+ NS_LOG_FUNCTION (this << exit);
SetRootExitDirection (exit.first, exit.second);
}
SPFVertex::NodeExit_t
SPFVertex::GetRootExitDirection (uint32_t i) const
{
- NS_LOG_FUNCTION (i);
+ NS_LOG_FUNCTION (this << i);
typedef ListOfNodeExit_t::const_iterator CIter_t;
NS_ASSERT_MSG (i < m_ecmpRootExits.size (), "Index out-of-range when accessing SPFVertex::m_ecmpRootExits!");
@@ -304,7 +304,7 @@
SPFVertex::NodeExit_t
SPFVertex::GetRootExitDirection () const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
NS_ASSERT_MSG (m_ecmpRootExits.size () <= 1, "Assumed there is at most one exit from the root to this vertex");
return GetRootExitDirection (0);
@@ -313,7 +313,7 @@
void
SPFVertex::MergeRootExitDirections (const SPFVertex* vertex)
{
- NS_LOG_FUNCTION (vertex);
+ NS_LOG_FUNCTION (this << vertex);
// obtain the external list of exit directions
//
@@ -328,7 +328,7 @@
void
SPFVertex::InheritAllRootExitDirections (const SPFVertex* vertex)
{
- NS_LOG_FUNCTION (vertex);
+ NS_LOG_FUNCTION (this << vertex);
// discard all exit direction currently associated with this vertex,
// and copy all the exit directions from the given vertex
@@ -344,21 +344,21 @@
uint32_t
SPFVertex::GetNRootExitDirections () const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_ecmpRootExits.size ();
}
uint32_t
SPFVertex::GetNChildren (void) const
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
return m_children.size ();
}
SPFVertex*
SPFVertex::GetChild (uint32_t n) const
{
- NS_LOG_FUNCTION (n);
+ NS_LOG_FUNCTION (this << n);
uint32_t j = 0;
for ( ListOfSPFVertex_t::const_iterator i = m_children.begin ();
@@ -377,7 +377,7 @@
uint32_t
SPFVertex::AddChild (SPFVertex* child)
{
- NS_LOG_FUNCTION (child);
+ NS_LOG_FUNCTION (this << child);
m_children.push_back (child);
return m_children.size ();
}
@@ -385,18 +385,21 @@
void
SPFVertex::SetVertexProcessed (bool value)
{
+ NS_LOG_FUNCTION (this << value);
m_vertexProcessed = value;
}
bool
SPFVertex::IsVertexProcessed (void) const
{
+ NS_LOG_FUNCTION (this);
return m_vertexProcessed;
}
void
SPFVertex::ClearVertexProcessed (void)
{
+ NS_LOG_FUNCTION (this);
for (uint32_t i = 0; i < this->GetNChildren (); i++)
{
this->GetChild (i)->ClearVertexProcessed ();
@@ -415,12 +418,12 @@
m_database (),
m_extdatabase ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
}
GlobalRouteManagerLSDB::~GlobalRouteManagerLSDB ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
LSDBMap_t::iterator i;
for (i= m_database.begin (); i!= m_database.end (); i++)
{
@@ -441,7 +444,7 @@
void
GlobalRouteManagerLSDB::Initialize ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
LSDBMap_t::iterator i;
for (i= m_database.begin (); i!= m_database.end (); i++)
{
@@ -453,7 +456,7 @@
void
GlobalRouteManagerLSDB::Insert (Ipv4Address addr, GlobalRoutingLSA* lsa)
{
- NS_LOG_FUNCTION (addr << lsa);
+ NS_LOG_FUNCTION (this << addr << lsa);
if (lsa->GetLSType () == GlobalRoutingLSA::ASExternalLSAs)
{
m_extdatabase.push_back (lsa);
@@ -467,19 +470,21 @@
GlobalRoutingLSA*
GlobalRouteManagerLSDB::GetExtLSA (uint32_t index) const
{
+ NS_LOG_FUNCTION (this << index);
return m_extdatabase.at (index);
}
uint32_t
GlobalRouteManagerLSDB::GetNumExtLSAs () const
{
+ NS_LOG_FUNCTION (this);
return m_extdatabase.size ();
}
GlobalRoutingLSA*
GlobalRouteManagerLSDB::GetLSA (Ipv4Address addr) const
{
- NS_LOG_FUNCTION (addr);
+ NS_LOG_FUNCTION (this << addr);
//
// Look up an LSA by its address.
//
@@ -497,7 +502,7 @@
GlobalRoutingLSA*
GlobalRouteManagerLSDB::GetLSAByLinkData (Ipv4Address addr) const
{
- NS_LOG_FUNCTION (addr);
+ NS_LOG_FUNCTION (this << addr);
//
// Look up an LSA by its address.
//
@@ -529,13 +534,13 @@
:
m_spfroot (0)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
m_lsdb = new GlobalRouteManagerLSDB ();
}
GlobalRouteManagerImpl::~GlobalRouteManagerImpl ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
if (m_lsdb)
{
delete m_lsdb;
@@ -545,7 +550,7 @@
void
GlobalRouteManagerImpl::DebugUseLsdb (GlobalRouteManagerLSDB* lsdb)
{
- NS_LOG_FUNCTION (lsdb);
+ NS_LOG_FUNCTION (this << lsdb);
if (m_lsdb)
{
delete m_lsdb;
@@ -556,7 +561,7 @@
void
GlobalRouteManagerImpl::DeleteGlobalRoutes ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
NodeList::Iterator listEnd = NodeList::End ();
for (NodeList::Iterator i = NodeList::Begin (); i != listEnd; i++)
{
@@ -600,7 +605,7 @@
void
GlobalRouteManagerImpl::BuildGlobalRoutingDatabase ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
//
// Walk the list of nodes looking for the GlobalRouter Interface. Nodes with
// global router interfaces are, not too surprisingly, our routers.
@@ -683,7 +688,7 @@
void
GlobalRouteManagerImpl::InitializeRoutes ()
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this);
//
// Walk the list of nodes in the system.
//
@@ -733,7 +738,7 @@
void
GlobalRouteManagerImpl::SPFNext (SPFVertex* v, CandidateQueue& candidate)
{
- NS_LOG_FUNCTION (v << &candidate);
+ NS_LOG_FUNCTION (this << v << &candidate);
SPFVertex* w = 0;
GlobalRoutingLSA* w_lsa = 0;
@@ -969,7 +974,7 @@
GlobalRoutingLinkRecord* l,
uint32_t distance)
{
- NS_LOG_FUNCTION (v << w << l << distance);
+ NS_LOG_FUNCTION (this << v << w << l << distance);
//
// If w is a NetworkVertex, l should be null
/*
@@ -1156,7 +1161,7 @@
SPFVertex* w,
GlobalRoutingLinkRecord* prev_link)
{
- NS_LOG_FUNCTION (v << w << prev_link);
+ NS_LOG_FUNCTION (this << v << w << prev_link);
bool skip = true;
bool found_prev_link = false;
@@ -1231,7 +1236,7 @@
void
GlobalRouteManagerImpl::DebugSPFCalculate (Ipv4Address root)
{
- NS_LOG_FUNCTION (root);
+ NS_LOG_FUNCTION (this << root);
SPFCalculate (root);
}
@@ -1244,7 +1249,7 @@
bool
GlobalRouteManagerImpl::CheckForStubNode (Ipv4Address root)
{
- NS_LOG_FUNCTION (root);
+ NS_LOG_FUNCTION (this << root);
GlobalRoutingLSA *rlsa = m_lsdb->GetLSA (root);
Ipv4Address myRouterId = rlsa->GetLinkStateId ();
int transits = 0;
@@ -1492,7 +1497,7 @@
void
GlobalRouteManagerImpl::ProcessASExternals (SPFVertex* v, GlobalRoutingLSA* extlsa)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << v << extlsa);
NS_LOG_LOGIC ("Processing external for destination " <<
extlsa->GetLinkStateId () <<
", for router " << v->GetVertexId () <<
@@ -1526,7 +1531,7 @@
void
GlobalRouteManagerImpl::SPFAddASExternal (GlobalRoutingLSA *extlsa, SPFVertex *v)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << extlsa << v);
NS_ASSERT_MSG (m_spfroot, "GlobalRouteManagerImpl::SPFAddASExternal (): Root pointer not set");
// Two cases to consider: We are advertising the external ourselves
@@ -1653,7 +1658,7 @@
void
GlobalRouteManagerImpl::SPFProcessStubs (SPFVertex* v)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << v);
NS_LOG_LOGIC ("Processing stubs for " << v->GetVertexId ());
if (v->GetVertexType () == SPFVertex::VertexRouter)
{
@@ -1687,7 +1692,7 @@
void
GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex* v)
{
- NS_LOG_FUNCTION_NOARGS ();
+ NS_LOG_FUNCTION (this << l << v);
NS_ASSERT_MSG (m_spfroot,
"GlobalRouteManagerImpl::SPFIntraAddStub (): Root pointer not set");
@@ -1827,7 +1832,7 @@
int32_t
GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask)
{
- NS_LOG_FUNCTION (a << amask);
+ NS_LOG_FUNCTION (this << a << amask);
//
// We have an IP address <a> and a vertex ID of the root of the SPF tree.
// The question is what interface index does this address correspond to.
@@ -1914,7 +1919,7 @@
void
GlobalRouteManagerImpl::SPFIntraAddRouter (SPFVertex* v)
{
- NS_LOG_FUNCTION (v);
+ NS_LOG_FUNCTION (this << v);
NS_ASSERT_MSG (m_spfroot,
"GlobalRouteManagerImpl::SPFIntraAddRouter (): Root pointer not set");
@@ -2059,7 +2064,7 @@
void
GlobalRouteManagerImpl::SPFIntraAddTransit (SPFVertex* v)
{
- NS_LOG_FUNCTION (v);
+ NS_LOG_FUNCTION (this << v);
NS_ASSERT_MSG (m_spfroot,
"GlobalRouteManagerImpl::SPFIntraAddTransit (): Root pointer not set");
@@ -2177,7 +2182,7 @@
void
GlobalRouteManagerImpl::SPFVertexAddParent (SPFVertex* v)
{
- NS_LOG_FUNCTION (v);
+ NS_LOG_FUNCTION (this << v);
for (uint32_t i=0;;)
{