publisher: implement routing table dataset publisher
refs: #3631, #3634
Change-Id: I7e961fdd0857690bee65d2bdfa4cf3de90ccac06
diff --git a/tools/nlsrc.hpp b/tools/nlsrc.hpp
index 3dd44d6..a5c6368 100644
--- a/tools/nlsrc.hpp
+++ b/tools/nlsrc.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2017, The University of Memphis,
+ * Copyright (c) 2014-2018, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -22,6 +22,8 @@
#include "tlv/adjacency-lsa.hpp"
#include "tlv/coordinate-lsa.hpp"
#include "tlv/name-lsa.hpp"
+#include "tlv/routing-table-status.hpp"
+
#include <boost/noncopyable.hpp>
#include <ndn-cxx/face.hpp>
@@ -47,7 +49,7 @@
printUsage();
void
- getStatus();
+ getStatus(const std::string& command);
bool
dispatch(const std::string& cmd);
@@ -89,6 +91,12 @@
fetchAdjacencyLsas();
void
+ fetchRtables();
+
+ void
+ fetchHRRtables();
+
+ void
fetchCoordinateLsas();
void
@@ -101,6 +109,10 @@
template <class T>
void
+ fetchFromRt(const std::function<void(const T&)>& recordLsa);
+
+ template <class T>
+ void
onFetchSuccess(const ndn::ConstBufferPtr& data,
const std::function<void(const T&)>& recordLsa);
@@ -111,6 +123,9 @@
std::string
getLsaInfoString(const nlsr::tlv::LsaInfo& info);
+ std::string
+ getDesString(const nlsr::tlv::Destination& des);
+
void
recordAdjacencyLsa(const nlsr::tlv::AdjacencyLsa& lsa);
@@ -121,8 +136,17 @@
recordNameLsa(const nlsr::tlv::NameLsa& lsa);
void
+ recordRtable(const nlsr::tlv::RoutingTable& rts);
+
+ void
printLsdb();
+ void
+ printRT();
+
+ void
+ printAll();
+
public:
const char* programName;
@@ -136,10 +160,14 @@
std::string adjacencyLsaString;
std::string coordinateLsaString;
std::string nameLsaString;
+ std::string rtString;
};
Router&
- getRouter(const nlsr::tlv::LsaInfo& info);
+ getRouterLsdb(const nlsr::tlv::LsaInfo& info);
+
+ Router&
+ getRouterRT(const nlsr::tlv::Destination& des);
typedef std::map<const ndn::Name, Router> RouterMap;
RouterMap m_routers;
@@ -148,6 +176,7 @@
ndn::KeyChain m_keyChain;
ndn::Face& m_face;
ndn::security::ValidatorNull m_validator;
+ std::string commandString;
std::deque<std::function<void()>> m_fetchSteps;
@@ -155,6 +184,8 @@
static const ndn::Name LSDB_PREFIX;
static const ndn::Name NAME_UPDATE_PREFIX;
+ static const ndn::Name RT_PREFIX;
+
static const uint32_t ERROR_CODE_TIMEOUT;
static const uint32_t RESPONSE_CODE_SUCCESS;
};