first working router

This commit is contained in:
Craig Dowell
2007-07-10 09:31:07 -07:00
parent 3640d302e1
commit 0068da44d4
2 changed files with 19 additions and 15 deletions

View File

@@ -92,10 +92,8 @@ StaticRouteManager::BuildStaticRoutingDatabase ()
StaticRouterLSA lsa;
rtr->GetLSA(j, lsa);
NS_DEBUG_UNCOND ("LSA " << j);
NS_DEBUG_UNCOND ("----------------------------------------");
NS_DEBUG_UNCOND("m_linkStateId = " << lsa.m_linkStateId);
NS_DEBUG_UNCOND("m_advertisingRtr = " << lsa.m_advertisingRtr);
NS_DEBUG_UNCOND ("----------------------------------------");
NS_DEBUG_UNCOND ("----------------------------");
NS_DEBUG_UNCOND(lsa);
}
}
}

View File

@@ -35,9 +35,6 @@ StaticRouterLSA::StaticRouterLSA()
NS_DEBUG("StaticRouterLSA::StaticRouterLSA ()");
}
//
// Copy constructor for StaticRouterLSA
//
StaticRouterLSA::StaticRouterLSA (StaticRouterLSA& lsa)
: m_linkStateId(lsa.m_linkStateId), m_advertisingRtr(lsa.m_advertisingRtr)
{
@@ -57,18 +54,27 @@ StaticRouterLSA::StaticRouterLSA (StaticRouterLSA& lsa)
}
}
//
// Assignment operator for StaticRouterLSA
//
// This uses the non-obvious trick of taking the source LSA passed by
// value instead of by reference. This causes the copy constructor to be
// invoked (where the real work is done -- see above). All we have to do
// here is to return the newly constructed LSA.
//
StaticRouterLSA&
StaticRouterLSA::operator= (StaticRouterLSA lsa)
{
NS_DEBUG("StaticRouterLSA Operator =");
NS_ASSERT_MSG(IsEmpty(), "The LSA must be empty before assignment");
m_linkStateId = lsa.m_linkStateId;
m_advertisingRtr = lsa.m_advertisingRtr;
for ( ListOfLinkRecords_t::iterator i = lsa.m_linkRecords.begin ();
i != lsa.m_linkRecords.end ();
i++)
{
StaticRouterLinkRecord *pSrc = *i;
StaticRouterLinkRecord *pDst = new StaticRouterLinkRecord;
pDst->m_linkId = pSrc->m_linkId;
pDst->m_linkData = pSrc->m_linkData;
m_linkRecords.push_back(pDst);
pDst = 0;
}
return *this;
}