tools: ndn-autoconfig code style corrections
refs #2426
Change-Id: Ied8de3b3f839e07090fc71f41cd01f4e5b4987f3
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index a474899..4efcec6 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.cpp
@@ -36,8 +36,8 @@
MulticastDiscovery::MulticastDiscovery(Face& face, KeyChain& keyChain,
const NextStageCallback& nextStageOnFailure)
: Base(face, keyChain, nextStageOnFailure)
- , nRequestedRegs(0)
- , nFinishedRegs(0)
+ , m_nRequestedRegs(0)
+ , m_nFinishedRegs(0)
{
}
@@ -46,14 +46,11 @@
{
std::cerr << "Trying multicast discovery..." << std::endl;
- util::SegmentFetcher::fetch(m_face, Interest("/localhost/nfd/faces/list"),
- m_validator,
- [this] (const ConstBufferPtr& data) {
- registerHubDiscoveryPrefix(data);
- },
- [this] (uint32_t code, const std::string& msg) {
- m_nextStageOnFailure(msg);
- });
+ util::SegmentFetcher::fetch(
+ m_face, Interest("/localhost/nfd/faces/list"),
+ m_validator,
+ [this] (const ConstBufferPtr& data) { registerHubDiscoveryPrefix(data); },
+ [this] (uint32_t code, const std::string& msg) { m_nextStageOnFailure(msg); });
}
void
@@ -73,9 +70,9 @@
offset += block.size();
- nfd::FaceStatus faceStatus(block);
+ ndn::nfd::FaceStatus faceStatus(block);
- ndn::util::FaceUri uri(faceStatus.getRemoteUri());
+ FaceUri uri(faceStatus.getRemoteUri());
if (uri.getScheme() == "udp4") {
namespace ip = boost::asio::ip;
boost::system::error_code ec;
@@ -93,22 +90,21 @@
m_nextStageOnFailure("No multicast faces available, skipping multicast discovery stage");
}
else {
- nfd::ControlParameters parameters;
+ ControlParameters parameters;
parameters
.setName(LOCALHOP_HUB_DISCOVERY_PREFIX)
.setCost(1)
.setExpirationPeriod(time::seconds(30));
- nRequestedRegs = multicastFaces.size();
- nFinishedRegs = 0;
+ m_nRequestedRegs = multicastFaces.size();
+ m_nFinishedRegs = 0;
for (const auto& face : multicastFaces) {
parameters.setFaceId(face);
- m_controller.start<nfd::RibRegisterCommand>(parameters,
- bind(&MulticastDiscovery::onRegisterSuccess,
- this),
- bind(&MulticastDiscovery::onRegisterFailure,
- this, _1));
+ m_controller.start<ndn::nfd::RibRegisterCommand>(
+ parameters,
+ bind(&MulticastDiscovery::onRegisterSuccess, this),
+ bind(&MulticastDiscovery::onRegisterFailure, this, _1));
}
}
}
@@ -116,23 +112,24 @@
void
MulticastDiscovery::onRegisterSuccess()
{
- ++nFinishedRegs;
+ ++m_nFinishedRegs;
- if (nRequestedRegs == nFinishedRegs) {
+ if (m_nRequestedRegs == m_nFinishedRegs) {
MulticastDiscovery::setStrategy();
}
}
void
-MulticastDiscovery::onRegisterFailure(const nfd::ControlResponse& response)
+MulticastDiscovery::onRegisterFailure(const ControlResponse& response)
{
std::cerr << "ERROR: " << response.getText() << " (code: " << response.getCode() << ")" << std::endl;
- --nRequestedRegs;
+ --m_nRequestedRegs;
- if (nRequestedRegs == nFinishedRegs) {
- if (nRequestedRegs > 0) {
+ if (m_nRequestedRegs == m_nFinishedRegs) {
+ if (m_nRequestedRegs > 0) {
MulticastDiscovery::setStrategy();
- } else {
+ }
+ else {
m_nextStageOnFailure("Failed to register " + LOCALHOP_HUB_DISCOVERY_PREFIX.toUri() +
" for all multicast faces, skipping multicast discovery stage");
}
@@ -142,19 +139,19 @@
void
MulticastDiscovery::setStrategy()
{
- nfd::ControlParameters parameters;
+ ControlParameters parameters;
parameters
.setName(LOCALHOP_HUB_DISCOVERY_PREFIX)
.setStrategy("/localhost/nfd/strategy/multicast");
- m_controller.start<nfd::StrategyChoiceSetCommand>(parameters,
- bind(&MulticastDiscovery::requestHubData, this),
- bind(&MulticastDiscovery::onSetStrategyFailure,
- this, _1));
+ m_controller.start<ndn::nfd::StrategyChoiceSetCommand>(
+ parameters,
+ bind(&MulticastDiscovery::requestHubData, this),
+ bind(&MulticastDiscovery::onSetStrategyFailure, this, _1));
}
void
-MulticastDiscovery::onSetStrategyFailure(const nfd::ControlResponse& response)
+MulticastDiscovery::onSetStrategyFailure(const ControlResponse& response)
{
m_nextStageOnFailure("Failed to set multicast strategy for " +
LOCALHOP_HUB_DISCOVERY_PREFIX.toUri() + " namespace (" + response.getText() + "). "