Refactor and modernize namespace declarations
Move all unit tests to namespace nfd::tests
Delete unused header core/algorithm.hpp
Change-Id: I5591f0c5f3bb5db67f8b45fae95471f8a555ca68
diff --git a/daemon/rib/fib-update.cpp b/daemon/rib/fib-update.cpp
index 25e2a62..ca53565 100644
--- a/daemon/rib/fib-update.cpp
+++ b/daemon/rib/fib-update.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,8 +25,7 @@
#include "fib-update.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
FibUpdate
FibUpdate::createAddUpdate(const Name& name, const uint64_t faceId, const uint64_t cost)
@@ -53,5 +52,4 @@
return update;
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/fib-update.hpp b/daemon/rib/fib-update.hpp
index 5339a37..6eead74 100644
--- a/daemon/rib/fib-update.hpp
+++ b/daemon/rib/fib-update.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,8 +28,7 @@
#include "core/common.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \class FibUpdate
* \brief represents a FIB update
@@ -90,7 +89,6 @@
return os;
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_FIB_UPDATE_HPP
diff --git a/daemon/rib/fib-updater.cpp b/daemon/rib/fib-updater.cpp
index 5208e61..6f82b17 100644
--- a/daemon/rib/fib-updater.cpp
+++ b/daemon/rib/fib-updater.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,8 +28,7 @@
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
NFD_LOG_INIT(FibUpdater);
@@ -708,5 +707,4 @@
m_inheritedRoutes.push_back(update);
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/fib-updater.hpp b/daemon/rib/fib-updater.hpp
index d43f50a..e231341 100644
--- a/daemon/rib/fib-updater.hpp
+++ b/daemon/rib/fib-updater.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,8 +33,7 @@
#include <ndn-cxx/mgmt/nfd/controller.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief computes FibUpdates based on updates to the RIB and sends them to NFD
*/
@@ -267,7 +266,6 @@
RibUpdateList m_inheritedRoutes;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_FIB_UPDATER_HPP
diff --git a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
index 7aff618..dcce60a 100644
--- a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
+++ b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
@@ -25,8 +25,7 @@
#include "client-to-nlsr-readvertise-policy.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
std::optional<ReadvertiseAction>
ClientToNlsrReadvertisePolicy::handleNewRoute(const RibRouteRef& ribRoute) const
@@ -45,5 +44,4 @@
return 1_h;
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
index c0d5837..be76597 100644
--- a/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
+++ b/daemon/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
@@ -28,8 +28,7 @@
#include "readvertise-policy.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief a policy to readvertise routes registered by end hosts into NLSR
*/
@@ -48,7 +47,6 @@
getRefreshInterval() const override;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_READVERTISE_CLIENT_TO_NLSR_READVERTISE_POLICY_HPP
diff --git a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
index 5aa6e3b..2d8d3a5 100644
--- a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
+++ b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.cpp
@@ -30,8 +30,7 @@
#include <ndn-cxx/security/pib/identity.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
const name::Component IGNORE_COMPONENT("nrd");
const time::seconds DEFAULT_REFRESH_INTERVAL = 25_s;
@@ -85,5 +84,4 @@
return m_refreshInterval;
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
index ac2491d..63b4fc8 100644
--- a/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
+++ b/daemon/rib/readvertise/host-to-gateway-readvertise-policy.hpp
@@ -31,8 +31,7 @@
#include <ndn-cxx/security/key-chain.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief a policy to readvertise routes registered by local applications into remote gateway
*/
@@ -54,7 +53,6 @@
time::seconds m_refreshInterval;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_READVERTISE_HOST_TO_GATEWAY_READVERTISE_POLICY_HPP
diff --git a/daemon/rib/readvertise/nfd-rib-readvertise-destination.cpp b/daemon/rib/readvertise/nfd-rib-readvertise-destination.cpp
index 0592040..413320e 100644
--- a/daemon/rib/readvertise/nfd-rib-readvertise-destination.cpp
+++ b/daemon/rib/readvertise/nfd-rib-readvertise-destination.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,8 +29,7 @@
#include <ndn-cxx/mgmt/nfd/control-command.hpp>
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
NFD_LOG_INIT(NfdRibReadvertiseDestination);
@@ -85,5 +84,4 @@
getCommandOptions().setSigningInfo(rr.signer));
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp b/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp
index 0f61669..ab2f710 100644
--- a/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp
+++ b/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,8 +33,7 @@
#include <ndn-cxx/mgmt/nfd/controller.hpp>
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief a readvertise destination using NFD RIB management protocol
*/
@@ -84,7 +83,6 @@
ndn::nfd::ControlParameters m_controlParameters;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_READVERTISE_NFD_RIB_READVERTISE_DESTINATION_HPP
diff --git a/daemon/rib/readvertise/readvertise-destination.cpp b/daemon/rib/readvertise/readvertise-destination.cpp
index 972c1dc..53f82ab 100644
--- a/daemon/rib/readvertise/readvertise-destination.cpp
+++ b/daemon/rib/readvertise/readvertise-destination.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,8 +26,7 @@
#include "readvertise-destination.hpp"
#include "common/logger.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
NFD_LOG_INIT(ReadvertiseDestination);
@@ -46,5 +45,4 @@
}
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/readvertise/readvertise-destination.hpp b/daemon/rib/readvertise/readvertise-destination.hpp
index 1c4fb76..045483a 100644
--- a/daemon/rib/readvertise/readvertise-destination.hpp
+++ b/daemon/rib/readvertise/readvertise-destination.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,8 +28,7 @@
#include "readvertised-route.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief a destination to readvertise into
*/
@@ -68,7 +67,6 @@
bool m_isAvailable = false;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_READVERTISE_READVERTISE_DESTINATION_HPP
diff --git a/daemon/rib/readvertise/readvertise-policy.hpp b/daemon/rib/readvertise/readvertise-policy.hpp
index da22139..3e4456e 100644
--- a/daemon/rib/readvertise/readvertise-policy.hpp
+++ b/daemon/rib/readvertise/readvertise-policy.hpp
@@ -30,8 +30,7 @@
#include <ndn-cxx/security/signing-info.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief a decision made by readvertise policy
*/
@@ -60,7 +59,6 @@
getRefreshInterval() const = 0;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_READVERTISE_READVERTISE_POLICY_HPP
diff --git a/daemon/rib/readvertise/readvertise.cpp b/daemon/rib/readvertise/readvertise.cpp
index ded568d..f7eb4cd 100644
--- a/daemon/rib/readvertise/readvertise.cpp
+++ b/daemon/rib/readvertise/readvertise.cpp
@@ -29,8 +29,7 @@
#include <ndn-cxx/util/random.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
NFD_LOG_INIT(Readvertise);
@@ -193,5 +192,4 @@
});
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/readvertise/readvertise.hpp b/daemon/rib/readvertise/readvertise.hpp
index aeaa823..88b11aa 100644
--- a/daemon/rib/readvertise/readvertise.hpp
+++ b/daemon/rib/readvertise/readvertise.hpp
@@ -31,8 +31,7 @@
#include "readvertised-route.hpp"
#include "rib/rib.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief readvertise a subset of routes to a destination according to a policy
*
@@ -81,7 +80,6 @@
signal::ScopedConnection m_removeRouteConn;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_READVERTISE_READVERTISE_HPP
diff --git a/daemon/rib/readvertise/readvertised-route.hpp b/daemon/rib/readvertise/readvertised-route.hpp
index 3749336..e4be12c 100644
--- a/daemon/rib/readvertise/readvertised-route.hpp
+++ b/daemon/rib/readvertise/readvertised-route.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,8 +31,7 @@
#include <ndn-cxx/security/signing-info.hpp>
#include <ndn-cxx/util/scheduler.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief state of a readvertised route
*/
@@ -63,7 +62,6 @@
using ReadvertisedRouteContainer = std::set<ReadvertisedRoute>;
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_READVERTISE_READVERTISED_ROUTE_HPP
diff --git a/daemon/rib/rib-entry.cpp b/daemon/rib/rib-entry.cpp
index 1710aff..1df227e 100644
--- a/daemon/rib/rib-entry.cpp
+++ b/daemon/rib/rib-entry.cpp
@@ -28,8 +28,7 @@
#include <ndn-cxx/mgmt/nfd/control-command.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
NFD_LOG_INIT(RibEntry);
@@ -288,5 +287,4 @@
return os << "}";
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/rib-entry.hpp b/daemon/rib/rib-entry.hpp
index 79f1627..d98d72a 100644
--- a/daemon/rib/rib-entry.hpp
+++ b/daemon/rib/rib-entry.hpp
@@ -30,8 +30,7 @@
#include <list>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/**
* \brief Represents a RIB entry, which contains one or more Routes with the same prefix.
@@ -278,7 +277,6 @@
std::ostream&
operator<<(std::ostream& os, const RibEntry& entry);
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_RIB_ENTRY_HPP
diff --git a/daemon/rib/rib-update-batch.cpp b/daemon/rib/rib-update-batch.cpp
index e639ae3..12284f7 100644
--- a/daemon/rib/rib-update-batch.cpp
+++ b/daemon/rib/rib-update-batch.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,8 +25,7 @@
#include "rib-update-batch.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
RibUpdateBatch::RibUpdateBatch(uint64_t faceId)
: m_faceId(faceId)
@@ -59,5 +58,4 @@
return m_updates.size();
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/rib-update-batch.hpp b/daemon/rib/rib-update-batch.hpp
index f3facb3..a91cad3 100644
--- a/daemon/rib/rib-update-batch.hpp
+++ b/daemon/rib/rib-update-batch.hpp
@@ -30,8 +30,7 @@
#include <list>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
using RibUpdateList = std::list<RibUpdate>;
@@ -69,7 +68,6 @@
RibUpdateList m_updates;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_RIB_UPDATE_BATCH_HPP
diff --git a/daemon/rib/rib-update.cpp b/daemon/rib/rib-update.cpp
index be2636d..343d39e 100644
--- a/daemon/rib/rib-update.cpp
+++ b/daemon/rib/rib-update.cpp
@@ -25,8 +25,7 @@
#include "rib-update.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
std::ostream&
operator<<(std::ostream& os, RibUpdate::Action action)
@@ -55,5 +54,4 @@
<< "}";
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/rib-update.hpp b/daemon/rib/rib-update.hpp
index bcdb342..70bbe1e 100644
--- a/daemon/rib/rib-update.hpp
+++ b/daemon/rib/rib-update.hpp
@@ -29,8 +29,7 @@
#include "core/common.hpp"
#include "route.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/**
* \brief Represents a route that will be added to or removed from a namespace
@@ -118,7 +117,6 @@
std::ostream&
operator<<(std::ostream& os, const RibUpdate& update);
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_RIB_UPDATE_HPP
diff --git a/daemon/rib/rib.cpp b/daemon/rib/rib.cpp
index fe4db0b..1d002a1 100644
--- a/daemon/rib/rib.cpp
+++ b/daemon/rib/rib.cpp
@@ -27,8 +27,7 @@
#include "fib-updater.hpp"
#include "common/logger.hpp"
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
NFD_LOG_INIT(Rib);
@@ -496,5 +495,4 @@
return os;
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/rib.hpp b/daemon/rib/rib.hpp
index f6912c3..36d5e41 100644
--- a/daemon/rib/rib.hpp
+++ b/daemon/rib/rib.hpp
@@ -31,8 +31,7 @@
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
using ndn::nfd::ControlParameters;
@@ -254,7 +253,6 @@
std::ostream&
operator<<(std::ostream& os, const Rib& rib);
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_RIB_HPP
diff --git a/daemon/rib/route.cpp b/daemon/rib/route.cpp
index 99d80e5..78ccdad 100644
--- a/daemon/rib/route.cpp
+++ b/daemon/rib/route.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021, Regents of the University of California,
+ * Copyright (c) 2014-2022, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,8 +26,7 @@
#include "route.hpp"
#include <ndn-cxx/util/string-helper.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
const uint64_t PA_ROUTE_COST = 2048; ///< cost of route created by prefix announcement
@@ -92,5 +91,4 @@
return os;
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/route.hpp b/daemon/rib/route.hpp
index 9b0bead..eea42ee 100644
--- a/daemon/rib/route.hpp
+++ b/daemon/rib/route.hpp
@@ -35,8 +35,7 @@
#include <type_traits>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
/** \brief represents a route for a name prefix
*/
@@ -116,7 +115,6 @@
std::ostream&
operator<<(std::ostream& os, const Route& route);
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_ROUTE_HPP
diff --git a/daemon/rib/service.cpp b/daemon/rib/service.cpp
index d850ed2..1634ef9 100644
--- a/daemon/rib/service.cpp
+++ b/daemon/rib/service.cpp
@@ -38,8 +38,7 @@
#include <ndn-cxx/transport/tcp-transport.hpp>
#include <ndn-cxx/transport/unix-transport.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
NFD_LOG_INIT(RibService);
@@ -262,5 +261,4 @@
}
}
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
diff --git a/daemon/rib/service.hpp b/daemon/rib/service.hpp
index 8928011..02e1914 100644
--- a/daemon/rib/service.hpp
+++ b/daemon/rib/service.hpp
@@ -38,8 +38,7 @@
#include <ndn-cxx/transport/transport.hpp>
#include <ndn-cxx/util/scheduler.hpp>
-namespace nfd {
-namespace rib {
+namespace nfd::rib {
class Readvertise;
@@ -121,7 +120,6 @@
RibManager m_ribManager;
};
-} // namespace rib
-} // namespace nfd
+} // namespace nfd::rib
#endif // NFD_DAEMON_RIB_SERVICE_HPP