tools: fix compilation with Boost 1.67

Change-Id: I0f4bae23f26eca07044990ce6dd01da750cfb569
Refs: #4584
This commit is contained in:
Davide Pesavento committed 2018-04-17 21:30:09 -04:00
1 parent 7d9039bef9
commit 6d43393669
3 files changed
+24 -20

No files matched your search

+8 -15
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2013-2017 Regents of the University of California.
* Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,24 +24,17 @@
#include <boost/version.hpp>
namespace boost {
namespace asio {
#if BOOST_VERSION >= 106600
#include <boost/asio/ts/netfwd.hpp>
namespace boost {
namespace asio {
class io_context;
using io_service = io_context;
} // namespace asio
} // namespace boost
#else
namespace boost {
namespace asio {
class io_service;
} // namespace asio
} // namespace boost
#endif // BOOST_VERSION >= 106600
} // namespace asio
} // namespace boost
#endif // NDN_NET_ASIO_FWD_HPP
+7 -2
View File
@@ -22,7 +22,9 @@
#include "ndnsec.hpp"
#include "util.hpp"
#if BOOST_VERSION < 106700
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#endif // BOOST_VERSION < 106700
namespace ndn {
namespace ndnsec {
@@ -173,9 +175,12 @@ ndnsec_cert_dump(int argc, char** argv)
return 0;
}
if (isRepoOut) {
using namespace boost::asio::ip;
tcp::iostream requestStream;
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
requestStream.connect(repoHost, repoPort);
if (!requestStream) {
std::cerr << "fail to open the stream!" << std::endl;
+9 -3
View File
@@ -22,7 +22,9 @@
#include "ndnsec.hpp"
#include "util.hpp"
#if BOOST_VERSION < 106700
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#endif // BOOST_VERSION < 106700
namespace ndn {
namespace ndnsec {
@@ -40,14 +42,18 @@ public:
security::v2::Certificate
getCertificateHttp(const std::string& host, const std::string& port, const std::string& path)
{
using namespace boost::asio::ip;
tcp::iostream requestStream;
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
requestStream.connect(host, port);
if (!requestStream) {
BOOST_THROW_EXCEPTION(HttpException("HTTP connection error"));
}
requestStream << "GET " << path << " HTTP/1.0\r\n";
requestStream << "Host: " << host << "\r\n";
requestStream << "Accept: */*\r\n";