Project

General

Profile

Actions

Task #2310

closed

LSA string literals should be replaced with static variables

Added by Vince Lehman about 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
12/18/2014
Due date:
% Done:

100%

Estimated time:

Description

There are many places in the code where LSA types are set or compared using string literals:

In lsdb.cpp:

if (interestedLsType == "name") {
  processInterestForNameLsa(interest, originRouter.append(interestedLsType), seqNo);
}
else if (interestedLsType == "adjacency") {
  processInterestForAdjacencyLsa(interest, originRouter.append(interestedLsType), seqNo);
}
else if (interestedLsType == "coordinate") {
  processInterestForCoordinateLsa(interest, originRouter.append(interestedLsType), seqNo);
}

Code like this is prone to typos that cannot be caught by the compiler.

Instead, LSA types should be static member variables of their respective class and these static variables should be used in the
code in place of string literals.


Related issues 1 (0 open1 closed)

Related to NLSR - Bug #2322: NamePrefixTable::removeEntry appends LSA components incorrectlyClosedVince Lehman12/23/2014

Actions
Actions

Also available in: Atom PDF