tools: fix compilation with Boost 1.67
Change-Id: Ia2bdaa0c78757a03796acf64b15c781ec9fa6c0e
Refs: #4584
diff --git a/tests/daemon/face/transport.t.cpp b/tests/daemon/face/transport.t.cpp
index c9a4690..d06195e 100644
--- a/tests/daemon/face/transport.t.cpp
+++ b/tests/daemon/face/transport.t.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,
@@ -29,12 +29,14 @@
#include "dummy-receive-link-service.hpp"
#include "transport-test-common.hpp"
-#include <boost/mpl/empty_sequence.hpp>
+#include <boost/mpl/fold.hpp>
#include <boost/mpl/int.hpp>
-#include <boost/mpl/joint_view.hpp>
+#include <boost/mpl/lambda.hpp>
#include <boost/mpl/map.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/push_back.hpp>
#include <boost/mpl/set.hpp>
-#include <boost/mpl/transform_view.hpp>
+#include <boost/mpl/vector.hpp>
namespace nfd {
namespace face {
@@ -93,6 +95,7 @@
}
/** \brief a macro to declare a TransportState as a integral constant
+ * \note we cannot use mpl::integral_c because TransportState is not an integral type
*/
#define TRANSPORT_STATE_C(X) mpl::int_<static_cast<int>(TransportState::X)>
@@ -141,28 +144,23 @@
mpl::pair<TRANSPORT_STATE_C(FAILED), TRANSPORT_STATE_C(CLOSED)>
> ValidStateTransitions;
-/** \brief a metafunction class to generate a sequence of all state transitions
+/** \brief a metafunction to generate a sequence of all state transitions
* from a specified state
*/
-struct StateTransitionsFrom
+template<typename FromState, typename Result>
+struct StateTransitionsFrom : mpl::fold<
+ States,
+ Result,
+ mpl::push_back<mpl::_1, mpl::pair<FromState, mpl::_2>>>
{
- template<typename FROM>
- struct apply
- {
- typedef typename mpl::fold<
- States,
- mpl::vector<>,
- mpl::push_back<mpl::_1, mpl::pair<FROM, mpl::_2>>
- >::type type;
- };
};
/** \brief a sequence of all state transitions
*/
typedef mpl::fold<
States,
- mpl::empty_sequence,
- mpl::joint_view<mpl::_1, mpl::apply<StateTransitionsFrom, mpl::protect<mpl::_1>>::type>
+ mpl::vector<>,
+ mpl::lambda<StateTransitionsFrom<mpl::_2, mpl::_1>>
>::type AllStateTransitions;
#undef TRANSPORT_STATE_C
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
index 5365496..ef58ab5 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.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,
@@ -26,6 +26,7 @@
#include "ndn-fch-discovery.hpp"
#include <boost/algorithm/string.hpp>
+#include <boost/asio/ip/tcp.hpp>
#include <boost/regex.hpp>
#include <sstream>
@@ -144,22 +145,22 @@
NdnFchDiscovery::doStart()
{
try {
- using namespace boost::asio::ip;
- tcp::iostream requestStream;
-
- requestStream.expires_from_now(boost::posix_time::milliseconds(3000));
+ boost::asio::ip::tcp::iostream requestStream;
+#if BOOST_VERSION >= 106700
+ requestStream.expires_after(std::chrono::seconds(3));
+#else
+ requestStream.expires_from_now(boost::posix_time::seconds(3));
+#endif // BOOST_VERSION >= 106700
Url url(m_url);
if (!url.isValid()) {
BOOST_THROW_EXCEPTION(HttpException("Invalid NDN-FCH URL: " + m_url));
}
-
if (!boost::iequals(url.getScheme(), "http")) {
BOOST_THROW_EXCEPTION(HttpException("Only http:// NDN-FCH URLs are supported"));
}
requestStream.connect(url.getHost(), url.getPort());
-
if (!requestStream) {
BOOST_THROW_EXCEPTION(HttpException("HTTP connection error to " + m_url));
}
@@ -198,7 +199,6 @@
std::string hubHost;
requestStream >> hubHost;
-
if (hubHost.empty()) {
BOOST_THROW_EXCEPTION(HttpException("NDN-FCH did not return hub host"));
}