core: drop std::function and ndn::Exclude from common.hpp, add ndn::optional
Change-Id: Ie3983d8b6f9929430efd8ada8d942e3f95755cd4
diff --git a/rib/fib-updater.hpp b/rib/fib-updater.hpp
index d68210c..90a788e 100644
--- a/rib/fib-updater.hpp
+++ b/rib/fib-updater.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -54,8 +54,8 @@
public:
typedef std::list<FibUpdate> FibUpdateList;
- typedef function<void(RibUpdateList inheritedRoutes)> FibUpdateSuccessCallback;
- typedef function<void(uint32_t code, const std::string& error)> FibUpdateFailureCallback;
+ typedef std::function<void(RibUpdateList inheritedRoutes)> FibUpdateSuccessCallback;
+ typedef std::function<void(uint32_t code, const std::string& error)> FibUpdateFailureCallback;
FibUpdater(Rib& rib, ndn::nfd::Controller& controller);
diff --git a/rib/readvertise/client-to-nlsr-readvertise-policy.cpp b/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
index aba5fdb..ca54132 100644
--- a/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
+++ b/rib/readvertise/client-to-nlsr-readvertise-policy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,21 +28,21 @@
namespace nfd {
namespace rib {
-ndn::optional<ReadvertiseAction>
+optional<ReadvertiseAction>
ClientToNlsrReadvertisePolicy::handleNewRoute(const RibRouteRef& ribRoute) const
{
if (ribRoute.route->origin == ndn::nfd::ROUTE_ORIGIN_CLIENT) {
return ReadvertiseAction{ribRoute.entry->getName(), ndn::security::SigningInfo()};
}
else {
- return ndn::nullopt;
+ return nullopt;
}
}
time::milliseconds
ClientToNlsrReadvertisePolicy::getRefreshInterval() const
{
- return time::seconds(3600);
+ return 1_h;
}
} // namespace rib
diff --git a/rib/readvertise/client-to-nlsr-readvertise-policy.hpp b/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
index af1481a..fd87360 100644
--- a/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
+++ b/rib/readvertise/client-to-nlsr-readvertise-policy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -41,7 +41,7 @@
* If the route origin is "client" (typically from auto prefix propagation), readvertise it
* using the default signing identity.
*/
- ndn::optional<ReadvertiseAction>
+ optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const override;
time::milliseconds
diff --git a/rib/readvertise/readvertise-policy.hpp b/rib/readvertise/readvertise-policy.hpp
index dce10b1..0f63745 100644
--- a/rib/readvertise/readvertise-policy.hpp
+++ b/rib/readvertise/readvertise-policy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -50,7 +50,7 @@
/** \brief decide whether to readvertise a route, and what prefix to readvertise
*/
- virtual ndn::optional<ReadvertiseAction>
+ virtual optional<ReadvertiseAction>
handleNewRoute(const RibRouteRef& ribRoute) const = 0;
/** \return how often readvertisements made by this policy should be refreshed.
diff --git a/rib/readvertise/readvertise.cpp b/rib/readvertise/readvertise.cpp
index c585bf5..344bc7e 100644
--- a/rib/readvertise/readvertise.cpp
+++ b/rib/readvertise/readvertise.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -64,7 +64,7 @@
void
Readvertise::afterAddRoute(const RibRouteRef& ribRoute)
{
- ndn::optional<ReadvertiseAction> action = m_policy->handleNewRoute(ribRoute);
+ optional<ReadvertiseAction> action = m_policy->handleNewRoute(ribRoute);
if (!action) {
NFD_LOG_DEBUG("add-route " << ribRoute.entry->getName() << '(' << ribRoute.route->faceId <<
',' << ribRoute.route->origin << ") not-readvertising");
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index ba89719..c955a0d 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -231,7 +231,7 @@
route.setExpirationEvent(eventId);
}
else {
- route.expires = ndn::nullopt;
+ route.expires = nullopt;
}
NFD_LOG_INFO("Adding route " << parameters.getName() << " nexthop=" << route.faceId
@@ -412,7 +412,7 @@
Route route;
route.faceId = result.getFaceId();
route.origin = ndn::nfd::ROUTE_ORIGIN_APP;
- route.expires = ndn::nullopt;
+ route.expires = nullopt;
route.flags = ndn::nfd::ROUTE_FLAG_CHILD_INHERIT;
m_rib.insert(prefix, route);
diff --git a/rib/rib.hpp b/rib/rib.hpp
index 78ea766..14ce12d 100644
--- a/rib/rib.hpp
+++ b/rib/rib.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -112,8 +112,8 @@
findDescendantsForNonInsertedName(const Name& prefix) const;
public:
- typedef function<void()> UpdateSuccessCallback;
- typedef function<void(uint32_t code, const std::string& error)> UpdateFailureCallback;
+ using UpdateSuccessCallback = std::function<void()>;
+ using UpdateFailureCallback = std::function<void(uint32_t code, const std::string& error)>;
/** \brief passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates.
*
@@ -176,7 +176,7 @@
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
// Used by RibManager unit-tests to get sent batch to simulate successful FIB update
- function<void(RibUpdateBatch)> m_onSendBatchFromQueue;
+ std::function<void(RibUpdateBatch)> m_onSendBatchFromQueue;
void
erase(const Name& prefix, const Route& route);
diff --git a/rib/route.hpp b/rib/route.hpp
index 2dfeabb..5ad4d79 100644
--- a/rib/route.hpp
+++ b/rib/route.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,10 @@
#define NFD_RIB_ROUTE_HPP
#include "core/scheduler.hpp"
+
#include <ndn-cxx/encoding/nfd-constants.hpp>
#include <ndn-cxx/mgmt/nfd/route-flags-traits.hpp>
+
#include <type_traits>
namespace nfd {
@@ -64,7 +66,7 @@
ndn::nfd::RouteOrigin origin;
uint64_t cost;
std::underlying_type<ndn::nfd::RouteFlags>::type flags;
- ndn::optional<time::steady_clock::TimePoint> expires;
+ optional<time::steady_clock::TimePoint> expires;
private:
scheduler::EventId m_expirationEvent;