31 #include <boost/algorithm/string.hpp> 38 : m_hyperbolicState(hypState)
40 setSeqFileDirectory(filePath);
41 initiateSeqNoFromFile();
48 std::ofstream outputFile(m_seqFileNameWithPath.c_str());
49 std::ostringstream os;
50 os <<
"NameLsaSeq " << std::to_string(m_nameLsaSeq) <<
"\n" 51 <<
"AdjLsaSeq " << std::to_string(m_adjLsaSeq) <<
"\n" 52 <<
"CorLsaSeq " << std::to_string(m_corLsaSeq);
53 outputFile << os.str();
58 SequencingManager::initiateSeqNoFromFile()
61 std::ifstream inputFile(m_seqFileNameWithPath.c_str());
65 if (inputFile.good()) {
66 inputFile >> seqType >> m_nameLsaSeq;
67 inputFile >> seqType >> m_adjLsaSeq;
68 inputFile >> seqType >> m_corLsaSeq;
78 if (m_corLsaSeq != 0) {
79 NLSR_LOG_WARN(
"This router was previously configured for hyperbolic " <<
80 "routing without clearing the seq. no. file.");
88 if (m_adjLsaSeq != 0) {
89 NLSR_LOG_WARN(
"This router was previously configured for link-state " <<
90 "routing without clearing the seq. no. file.");
100 SequencingManager::setSeqFileDirectory(
const std::string& filePath)
102 m_seqFileNameWithPath = filePath;
104 if (m_seqFileNameWithPath.empty()) {
105 std::string homeDirPath(getpwuid(getuid())->pw_dir);
106 if (homeDirPath.empty()) {
107 homeDirPath = getenv(
"HOME");
109 m_seqFileNameWithPath = homeDirPath;
111 m_seqFileNameWithPath = m_seqFileNameWithPath +
"/nlsrSeqNo.txt";
115 SequencingManager::writeLog()
const
void writeSeqNoToFile() const
#define NLSR_LOG_DEBUG(x)
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
#define INIT_LOGGER(name)
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
SequencingManager(const std::string &filePath, int hypState)