lsa: change type variable to enum class

Change-Id: I7fba951649771700ce6ccc4be7fb400546607e96
refs: #4340
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 95b656c..d87f4fc 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -118,20 +118,21 @@
   // A router should not try to fetch its own LSA
   if (originRouter != m_confParam.getRouterPrefix()) {
 
-    std::string lsaType = updateName.get(updateName.size()-1).toUri();
+    Lsa::Type lsaType;
+    std::istringstream(updateName.get(updateName.size()-1).toUri()) >> lsaType;
 
     _LOG_DEBUG("Received sync update with higher " << lsaType
                << " sequence number than entry in LSDB");
 
     if (m_isLsaNew(originRouter, lsaType, seqNo)) {
-      if (lsaType == AdjLsa::TYPE_STRING && seqNo != 0 &&
+      if (lsaType == Lsa::Type::ADJACENCY && seqNo != 0 &&
           m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_ON) {
         _LOG_ERROR("Got an update for adjacency LSA when hyperbolic routing"
                    << " is enabled. Not going to fetch.");
         return;
       }
 
-      if (lsaType == CoordinateLsa::TYPE_STRING && seqNo != 0 &&
+      if (lsaType == Lsa::Type::COORDINATE && seqNo != 0 &&
           m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_OFF) {
         _LOG_ERROR("Got an update for coordinate LSA when link-state"
                    << " is enabled. Not going to fetch.");
@@ -143,7 +144,7 @@
 }
 
 void
-SyncLogicHandler::publishRoutingUpdate(const ndn::Name& type, const uint64_t& seqNo)
+SyncLogicHandler::publishRoutingUpdate(const Lsa::Type& type, const uint64_t& seqNo)
 {
   if (m_syncSocket == nullptr) {
     _LOG_FATAL("Cannot publish routing update; SyncSocket does not exist");
@@ -151,14 +152,19 @@
     BOOST_THROW_EXCEPTION(SyncLogicHandler::Error("Cannot publish routing update; SyncSocket does not exist"));
   }
 
-  if (type == NameLsa::TYPE_STRING) {
-    publishSyncUpdate(m_nameLsaUserPrefix, seqNo);
-  }
-  else if (type == AdjLsa::TYPE_STRING) {
+
+  switch (type) {
+  case Lsa::Type::ADJACENCY:
     publishSyncUpdate(m_adjLsaUserPrefix, seqNo);
-  }
-  else {
+    break;
+  case Lsa::Type::COORDINATE:
     publishSyncUpdate(m_coorLsaUserPrefix, seqNo);
+    break;
+  case Lsa::Type::NAME:
+    publishSyncUpdate(m_nameLsaUserPrefix, seqNo);
+    break;
+  default:
+    break;
   }
 }
 
@@ -170,13 +176,13 @@
   updatePrefix.append(m_confParam.getRouterName());
 
   m_nameLsaUserPrefix = updatePrefix;
-  m_nameLsaUserPrefix.append(NameLsa::TYPE_STRING);
+  m_nameLsaUserPrefix.append(std::to_string(Lsa::Type::NAME));
 
   m_adjLsaUserPrefix = updatePrefix;
-  m_adjLsaUserPrefix.append(AdjLsa::TYPE_STRING);
+  m_adjLsaUserPrefix.append(std::to_string(Lsa::Type::ADJACENCY));
 
   m_coorLsaUserPrefix = updatePrefix;
-  m_coorLsaUserPrefix.append(CoordinateLsa::TYPE_STRING);
+  m_coorLsaUserPrefix.append(std::to_string(Lsa::Type::COORDINATE));
 }
 
 void