--- a/src/routing/static-route-manager.cc Wed Jul 11 17:31:43 2007 -0700
+++ b/src/routing/static-route-manager.cc Wed Jul 11 22:37:48 2007 -0700
@@ -32,8 +32,7 @@
m_vertexType(VertexUnknown),
m_vertexId("255.255.255.255"),
m_lsa(0),
- m_distanceFromRoot(SPF_INFINITY),
- m_stat(LSA_SPF_NOT_EXPLORED)
+ m_distanceFromRoot(SPF_INFINITY)
{
}
@@ -46,7 +45,6 @@
SPFVertex::Initialize ()
{
m_distanceFromRoot = SPF_INFINITY;
- m_stat = LSA_SPF_NOT_EXPLORED;
// XXX previous = 0
}
@@ -244,19 +242,18 @@
// network-LSA) in Area A's link state database.
if (temp->m_linkType == StaticRouterLinkRecord::PointToPoint)
{
- // Lookup the LSA (vertex) for the neighbor
+ // Lookup the vertex W's LSA
StaticRouterLSA* w_lsa = m_lsdb->GetLSA(temp->m_linkId);
NS_ASSERT(w_lsa);
NS_DEBUG_UNCOND("Found a P2P record from " <<
v->m_vertexId << " to " << w_lsa->m_linkStateId);
-#if 0
// (c) If vertex W is already on the shortest-path tree,
// examine the next link in the LSA.
- if (w->m_stat == LSA_SPF_IN_SPFTREE)
+ if (w_lsa->m_stat == StaticRouterLSA::LSA_SPF_IN_SPFTREE)
{
+ NS_DEBUG("LSA "<< w_lsa->m_linkStateId << " in SPF");
continue;
}
-#endif
// (d) Calculate the link state cost D of the resulting path
// from the root to vertex W. D is equal to the sum of
// the link state cost of the (already calculated)
@@ -267,7 +264,12 @@
// Here, W is either already in candidate list or not
- // if (not in candidate list)
+#if 0
+ if (w_lsa->m_stat == StaticRouterLSA::LSA_SPF_NOT_EXPLORED)
+ {
+ SPFVertex* w = new SPFVertex(w_lsa);
+#endif
+
// ospf_nexthop_calculation()
// priority_queue.enqueu()
// else
@@ -325,7 +327,6 @@
// Set LSA position to LSA_SPF_IN_SPFTREE. This vertex is the root of the
// spanning tree.
v->m_distanceFromRoot = 0;
- v->m_stat = LSA_SPF_IN_SPFTREE;
for (;;)
{
--- a/src/routing/static-route-manager.h Wed Jul 11 17:31:43 2007 -0700
+++ b/src/routing/static-route-manager.h Wed Jul 11 22:37:48 2007 -0700
@@ -29,9 +29,6 @@
const uint32_t SPF_INFINITY = 0xffffffff;
-const int LSA_SPF_NOT_EXPLORED = -1;
-const int LSA_SPF_IN_SPFTREE = -2;
-
class CandidateQueue;
/**
@@ -65,8 +62,6 @@
uint32_t m_distanceFromRoot;
- // If stat >= 0, stat is LSA position in candidates heap
- int m_stat;
};
/**
--- a/src/routing/static-router.cc Wed Jul 11 17:31:43 2007 -0700
+++ b/src/routing/static-router.cc Wed Jul 11 22:37:48 2007 -0700
@@ -30,13 +30,15 @@
:
m_linkStateId("0.0.0.0"),
m_advertisingRtr("0.0.0.0"),
- m_linkRecords()
+ m_linkRecords(),
+ m_stat(StaticRouterLSA::LSA_SPF_NOT_EXPLORED)
{
NS_DEBUG("StaticRouterLSA::StaticRouterLSA ()");
}
StaticRouterLSA::StaticRouterLSA (StaticRouterLSA& lsa)
- : m_linkStateId(lsa.m_linkStateId), m_advertisingRtr(lsa.m_advertisingRtr)
+ : m_linkStateId(lsa.m_linkStateId), m_advertisingRtr(lsa.m_advertisingRtr),
+ m_stat(lsa.m_stat)
{
NS_ASSERT_MSG(IsEmpty(), "The LSA must be empty in its constructor!");
CopyLinkRecords (lsa);
@@ -47,6 +49,7 @@
{
m_linkStateId = lsa.m_linkStateId;
m_advertisingRtr = lsa.m_advertisingRtr;
+ m_stat = lsa.m_stat;
ClearLinkRecords ();
CopyLinkRecords (lsa);
@@ -201,6 +204,7 @@
StaticRouterLSA *pLSA = new StaticRouterLSA;
pLSA->m_linkStateId = m_routerId;
pLSA->m_advertisingRtr = m_routerId;
+ pLSA->m_stat = StaticRouterLSA::LSA_SPF_NOT_EXPLORED;
//
// We need to ask the node for the number of net devices attached. This isn't
// necessarily equal to the number of links to adjacent nodes (other routers)
--- a/src/routing/static-router.h Wed Jul 11 17:31:43 2007 -0700
+++ b/src/routing/static-router.h Wed Jul 11 22:37:48 2007 -0700
@@ -168,6 +168,14 @@
typedef std::list<StaticRouterLinkRecord*> ListOfLinkRecords_t;
ListOfLinkRecords_t m_linkRecords;
+
+ // this is a tristate flag used internally in the SPF computation
+ enum SPFStatus {
+ LSA_SPF_NOT_EXPLORED = 0,
+ LSA_SPF_IN_SPFTREE,
+ LSA_SPF_IN_CANDIDATE_QUEUE
+ } m_stat;
+
};
std::ostream& operator<< (std::ostream& os, StaticRouterLSA& lsa);