communication: sync protocol adapater to add psync

refs: #4082

Change-Id: Ibe4649e709dfbc3cdc1f2afbfc4ff03f75a3f136
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index d388221..c893e39 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -287,6 +287,21 @@
     return false;
   }
 
+  // sync-protocol
+  std::string syncProtocol = section.get<std::string>("sync-protocol", "chronosync");
+  if (syncProtocol == "chronosync") {
+    m_nlsr.getConfParameter().setSyncProtocol(SYNC_PROTOCOL_CHRONOSYNC);
+  }
+  else if (syncProtocol == "psync") {
+    m_nlsr.getConfParameter().setSyncProtocol(SYNC_PROTOCOL_PSYNC);
+  }
+  else {
+    std::cerr << "Sync protocol " << syncProtocol << " is not supported!"
+              << "Use chronosync or psync" << std::endl;
+    return false;
+  }
+
+  // sync-interest-lifetime
   uint32_t syncInterestLifetime = section.get<uint32_t>("sync-interest-lifetime", SYNC_INTEREST_LIFETIME_DEFAULT);
   if (syncInterestLifetime >= SYNC_INTEREST_LIFETIME_MIN &&
       syncInterestLifetime <= SYNC_INTEREST_LIFETIME_MAX) {