core+face: avoid deprecated Boost.Asio interfaces
Change-Id: I07ec286531edf63f258babe1561b4da2a88edd10
diff --git a/core/network.cpp b/core/network.cpp
index 08a1197..bc0db72 100644
--- a/core/network.cpp
+++ b/core/network.cpp
@@ -48,7 +48,7 @@
Network::getMaxRangeV4()
{
using boost::asio::ip::address_v4;
- static Network range{address_v4{}, address_v4{0xffffffff}};
+ static const Network range{address_v4{}, address_v4{0xffffffff}};
return range;
}
@@ -56,9 +56,9 @@
Network::getMaxRangeV6()
{
using boost::asio::ip::address_v6;
- static address_v6::bytes_type maxV6 = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
- static Network range{address_v6{}, address_v6{maxV6}};
+ static const address_v6::bytes_type maxV6 = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
+ static const Network range{address_v6{}, address_v6{maxV6}};
return range;
}
@@ -96,8 +96,8 @@
size_t position = networkStr.find('/');
if (position == std::string::npos) {
try {
- network.m_minAddress = ip::address::from_string(networkStr);
- network.m_maxAddress = ip::address::from_string(networkStr);
+ network.m_minAddress = ip::make_address(networkStr);
+ network.m_maxAddress = ip::make_address(networkStr);
}
catch (const boost::system::system_error&) {
is.setstate(std::ios::failbit);
@@ -106,7 +106,7 @@
}
else {
boost::system::error_code ec;
- auto address = ip::address::from_string(networkStr.substr(0, position), ec);
+ auto address = ip::make_address(networkStr.substr(0, position), ec);
if (ec) {
is.setstate(std::ios::failbit);
return is;
diff --git a/daemon/face/stream-transport.hpp b/daemon/face/stream-transport.hpp
index c8b0ac3..dcb5265 100644
--- a/daemon/face/stream-transport.hpp
+++ b/daemon/face/stream-transport.hpp
@@ -145,7 +145,7 @@
// Use the non-throwing variants and ignore errors, if any.
boost::system::error_code error;
m_socket.cancel(error);
- m_socket.shutdown(protocol::socket::shutdown_both, error);
+ m_socket.shutdown(boost::asio::socket_base::shutdown_both, error);
}
// Ensure that the Transport stays alive at least until
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index e3c9910..17f2786 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -52,7 +52,7 @@
void
TcpChannel::listen(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onAcceptFailed,
- int backlog/* = tcp::acceptor::max_connections*/)
+ int backlog)
{
if (isListening()) {
NFD_LOG_CHAN_WARN("Already listening");
@@ -150,7 +150,7 @@
NFD_LOG_CHAN_TRACE("Reusing existing face for " << remoteEndpoint);
boost::system::error_code error;
- socket.shutdown(ip::tcp::socket::shutdown_both, error);
+ socket.shutdown(boost::asio::socket_base::shutdown_both, error);
socket.close(error);
}
diff --git a/daemon/face/tcp-channel.hpp b/daemon/face/tcp-channel.hpp
index 811ee5e..1220687 100644
--- a/daemon/face/tcp-channel.hpp
+++ b/daemon/face/tcp-channel.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -40,20 +40,19 @@
const boost::asio::ip::address& remote)>;
/**
- * \brief Class implementing TCP-based channel to create faces
+ * \brief Class implementing a TCP-based channel to create faces.
*
- * Channel can create faces as a response to incoming TCP
- * connections (TcpChannel::listen needs to be called for that
- * to work) or explicitly after using TcpChannel::connect method.
+ * The channel can create faces as a response to incoming TCP connections (TcpChannel::listen()
+ * needs to be called for that to work) or explicitly by using TcpChannel::connect().
*/
class TcpChannel final : public Channel
{
public:
/**
- * \brief Create TCP channel for the local endpoint
+ * \brief Create a TCP channel for the specified \p localEndpoint.
*
- * To enable creation faces upon incoming connections,
- * one needs to explicitly call TcpChannel::listen method.
+ * To enable the creation of faces upon incoming connections, one needs to
+ * explicitly call listen().
*/
TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMarking,
DetermineFaceScopeFromAddress determineFaceScope);
@@ -72,7 +71,7 @@
/**
* \brief Enable listening on the local endpoint, accept connections,
- * and create faces when remote host makes a connection
+ * and create faces when remote host makes a connection.
* \param onFaceCreated Callback to notify successful creation of the face
* \param onAcceptFailed Callback to notify when channel fails (accept call
* returns an error)
@@ -82,10 +81,10 @@
void
listen(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onAcceptFailed,
- int backlog = boost::asio::ip::tcp::acceptor::max_connections);
+ int backlog = boost::asio::socket_base::max_listen_connections);
/**
- * \brief Create a face by establishing a TCP connection to \p remoteEndpoint
+ * \brief Create a face by establishing a TCP connection to \p remoteEndpoint.
*/
void
connect(const tcp::Endpoint& remoteEndpoint,
diff --git a/daemon/face/tcp-factory.cpp b/daemon/face/tcp-factory.cpp
index 1d25419..09d2cd4 100644
--- a/daemon/face/tcp-factory.cpp
+++ b/daemon/face/tcp-factory.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -163,7 +163,7 @@
return;
}
- tcp::Endpoint endpoint(ip::address::from_string(req.remoteUri.getHost()),
+ tcp::Endpoint endpoint(ip::make_address(req.remoteUri.getHost()),
boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
// a canonical tcp4/tcp6 FaceUri cannot have a multicast address
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index fafa29e..c4baac2 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -129,7 +129,7 @@
else if (key == "mcast_group") {
const std::string& valueStr = value.get_value<std::string>();
boost::system::error_code ec;
- mcastConfig.group.address(ip::address_v4::from_string(valueStr, ec));
+ mcastConfig.group.address(ip::make_address_v4(valueStr, ec));
if (ec) {
NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group: '" +
valueStr + "' cannot be parsed as an IPv4 address"));
@@ -145,7 +145,7 @@
else if (key == "mcast_group_v6") {
const std::string& valueStr = value.get_value<std::string>();
boost::system::error_code ec;
- mcastConfig.groupV6.address(ip::address_v6::from_string(valueStr, ec));
+ mcastConfig.groupV6.address(ip::make_address_v6(valueStr, ec));
if (ec) {
NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
valueStr + "' cannot be parsed as an IPv6 address"));
@@ -261,7 +261,7 @@
return;
}
- udp::Endpoint endpoint(ip::address::from_string(req.remoteUri.getHost()),
+ udp::Endpoint endpoint(ip::make_address(req.remoteUri.getHost()),
boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
if (endpoint.address().is_multicast()) {
diff --git a/daemon/face/udp-protocol.hpp b/daemon/face/udp-protocol.hpp
index 5f00b00..1004c3c 100644
--- a/daemon/face/udp-protocol.hpp
+++ b/daemon/face/udp-protocol.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -46,7 +46,7 @@
inline Endpoint
getDefaultMulticastGroup()
{
- return {boost::asio::ip::address_v4(0xE00017AA), 56363};
+ return {boost::asio::ip::make_address_v4(0xE00017AA), 56363};
}
/**
@@ -55,7 +55,7 @@
inline Endpoint
getDefaultMulticastGroupV6()
{
- return {boost::asio::ip::address_v6::from_string("FF02::1234"), 56363};
+ return {boost::asio::ip::make_address_v6("FF02::1234"), 56363};
}
} // namespace nfd::udp
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index 2526d45..b2bb84a 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -63,7 +63,7 @@
void
UnixStreamChannel::listen(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onAcceptFailed,
- int backlog/* = acceptor::max_connections*/)
+ int backlog)
{
if (isListening()) {
NFD_LOG_CHAN_WARN("Already listening");
diff --git a/daemon/face/unix-stream-channel.hpp b/daemon/face/unix-stream-channel.hpp
index b0fdf2c..705d6f8 100644
--- a/daemon/face/unix-stream-channel.hpp
+++ b/daemon/face/unix-stream-channel.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -37,16 +37,16 @@
namespace nfd::face {
/**
- * \brief Class implementing a local channel to create faces
+ * \brief Class implementing a local channel to create faces.
*
* Channel can create faces as a response to incoming IPC connections
- * (UnixStreamChannel::listen needs to be called for that to work).
+ * (UnixStreamChannel::listen() needs to be called for that to work).
*/
class UnixStreamChannel final : public Channel
{
public:
/**
- * \brief UnixStreamChannel-related error
+ * \brief UnixStreamChannel-related error.
*/
class Error : public std::runtime_error
{
@@ -55,10 +55,10 @@
};
/**
- * \brief Create UnixStream channel for the specified endpoint
+ * \brief Create a UnixStream channel for the specified \p endpoint.
*
- * To enable creation of faces upon incoming connections, one
- * needs to explicitly call UnixStreamChannel::listen method.
+ * To enable the creation of faces upon incoming connections, one needs to
+ * explicitly call listen().
*/
UnixStreamChannel(const unix_stream::Endpoint& endpoint, bool wantCongestionMarking);
@@ -77,7 +77,7 @@
}
/**
- * \brief Start listening
+ * \brief Start listening.
*
* Enable listening on the Unix socket, waiting for incoming connections,
* and creating a face when a connection is made.
@@ -94,7 +94,7 @@
void
listen(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onAcceptFailed,
- int backlog = boost::asio::local::stream_protocol::acceptor::max_connections);
+ int backlog = boost::asio::socket_base::max_listen_connections);
private:
void
diff --git a/daemon/face/websocket-transport.cpp b/daemon/face/websocket-transport.cpp
index df7b36b..8862b0f 100644
--- a/daemon/face/websocket-transport.cpp
+++ b/daemon/face/websocket-transport.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,12 +36,13 @@
if (addr.is_loopback()) {
return true;
}
+
// Workaround for loopback IPv4-mapped IPv6 addresses
// see https://svn.boost.org/trac/boost/ticket/9084
- else if (addr.is_v6()) {
+ if (addr.is_v6()) {
auto addr6 = addr.to_v6();
if (addr6.is_v4_mapped()) {
- return addr6.to_v4().is_loopback();
+ return boost::asio::ip::make_address_v4(boost::asio::ip::v4_mapped, addr6).is_loopback();
}
}
diff --git a/tests/core/network.t.cpp b/tests/core/network.t.cpp
index e65bad5..aa2c499 100644
--- a/tests/core/network.t.cpp
+++ b/tests/core/network.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,38 +31,34 @@
namespace nfd::tests {
-BOOST_AUTO_TEST_SUITE(TestNetwork)
+namespace ip = boost::asio::ip;
-using boost::asio::ip::address;
+BOOST_AUTO_TEST_SUITE(TestNetwork)
BOOST_AUTO_TEST_CASE(Empty)
{
Network n;
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:0:3025:ccc5:eeeb:86d3")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:0:3025:ccc5:eeeb:86d3")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("255.255.255.255")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("0.0.0.1")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("255.255.255.255")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
}
BOOST_AUTO_TEST_CASE(MaxRangeV4)
{
Network n = Network::getMaxRangeV4();
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("255.255.255.255")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("0.0.0.1")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("255.255.255.255")), true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
}
BOOST_AUTO_TEST_CASE(RangeV4)
@@ -73,35 +69,31 @@
BOOST_CHECK_THROW(boost::lexical_cast<Network>("192.0.2.0/255"), boost::bad_lexical_cast);
BOOST_CHECK_THROW(boost::lexical_cast<Network>("256.0.2.0/24"), boost::bad_lexical_cast);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.254")), true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.1.255")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.3.0")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.254")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.1.255")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.3.0")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("255.255.255.255")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("0.0.0.1")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("255.255.255.255")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
}
BOOST_AUTO_TEST_CASE(MaxRangeV6)
{
Network n = Network::getMaxRangeV6();
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
- true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("255.255.255.255")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("0.0.0.1")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("255.255.255.255")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
- true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), true);
}
BOOST_AUTO_TEST_CASE(RangeV6)
@@ -114,24 +106,18 @@
BOOST_CHECK_THROW(boost::lexical_cast<Network>("200x:db8:3f9:1::/64"), boost::bad_lexical_cast);
BOOST_CHECK_THROW(boost::lexical_cast<Network>("2001:db8:3f9::1::/64"), boost::bad_lexical_cast);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
- true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1::")),
- true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:ffff:ffff:ffff:ffff")),
- true);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:0:ffff:ffff:ffff:ffff")),
- false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:2::")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1::")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:ffff:ffff:ffff:ffff")), true);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:0:ffff:ffff:ffff:ffff")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:2::")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("255.255.255.255")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("0.0.0.1")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("255.255.255.255")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
- BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
- false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
+ BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
}
BOOST_AUTO_TEST_CASE(Comparisons)
diff --git a/tests/daemon/face/multicast-udp-transport-fixture.hpp b/tests/daemon/face/multicast-udp-transport-fixture.hpp
index 4c984f4..40c79ee 100644
--- a/tests/daemon/face/multicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/multicast-udp-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -49,11 +49,11 @@
ip::address mcastAddr;
if (address.is_v4()) {
// the administratively scoped group 224.0.0.254 is reserved for experimentation (RFC 4727)
- mcastAddr = ip::address_v4(0xE00000FE);
+ mcastAddr = ip::make_address_v4(0xE00000FE);
}
else {
// the group FF0X::114 is reserved for experimentation at all scope levels (RFC 4727)
- auto v6Addr = ip::address_v6::from_string("FF01::114");
+ auto v6Addr = ip::make_address_v6("FF01::114");
v6Addr.scope_id(netif->getIndex());
mcastAddr = v6Addr;
}
diff --git a/tests/daemon/face/network-predicate.t.cpp b/tests/daemon/face/network-predicate.t.cpp
index 05094fc..0595b48 100644
--- a/tests/daemon/face/network-predicate.t.cpp
+++ b/tests/daemon/face/network-predicate.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -69,19 +69,19 @@
protected:
NetworkInterfacePredicateFixture()
{
- using namespace boost::asio::ip;
using namespace ndn::net;
namespace ethernet = ndn::ethernet;
+ namespace ip = boost::asio::ip;
netifs.push_back(NetworkMonitorStub::makeNetworkInterface());
netifs.back()->setIndex(0);
netifs.back()->setName("eth0");
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:00"));
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
- address_v4::from_string("129.82.100.1"), address_v4::from_string("129.82.255.255"),
+ ip::make_address_v4("129.82.100.1"), ip::make_address_v4("129.82.255.255"),
16, AddressScope::GLOBAL, 0));
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V6,
- address_v6::from_string("2001:db8:1::1"), address_v6::from_string("2001:db8:1::ffff:ffff:ffff:ffff"),
+ ip::make_address_v6("2001:db8:1::1"), ip::make_address_v6("2001:db8:1::ffff:ffff:ffff:ffff"),
64, AddressScope::GLOBAL, 0));
netifs.back()->setFlags(IFF_UP);
@@ -90,10 +90,10 @@
netifs.back()->setName("eth1");
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:01"));
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
- address_v4::from_string("192.168.2.1"), address_v4::from_string("192.168.2.255"),
+ ip::make_address_v4("192.168.2.1"), ip::make_address_v4("192.168.2.255"),
24, AddressScope::GLOBAL, 0));
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V6,
- address_v6::from_string("2001:db8:2::1"), address_v6::from_string("2001:db8:2::ffff:ffff:ffff:ffff"),
+ ip::make_address_v6("2001:db8:2::1"), ip::make_address_v6("2001:db8:2::ffff:ffff:ffff:ffff"),
64, AddressScope::GLOBAL, 0));
netifs.back()->setFlags(IFF_UP);
@@ -102,10 +102,10 @@
netifs.back()->setName("eth2");
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:02"));
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
- address_v4::from_string("198.51.100.1"), address_v4::from_string("198.51.100.255"),
+ ip::make_address_v4("198.51.100.1"), ip::make_address_v4("198.51.100.255"),
24, AddressScope::GLOBAL, 0));
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V6,
- address_v6::from_string("2001:db8::1"), address_v6::from_string("2001:db8::ffff"),
+ ip::make_address_v6("2001:db8::1"), ip::make_address_v6("2001:db8::ffff"),
112, AddressScope::GLOBAL, 0));
netifs.back()->setFlags(IFF_MULTICAST | IFF_BROADCAST | IFF_UP);
@@ -114,7 +114,7 @@
netifs.back()->setName("enp68s0f1");
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:03"));
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
- address_v4::from_string("192.168.2.3"), address_v4::from_string("192.168.2.255"),
+ ip::make_address_v4("192.168.2.3"), ip::make_address_v4("192.168.2.255"),
24, AddressScope::GLOBAL, 0));
netifs.back()->setFlags(IFF_UP);
}
@@ -382,10 +382,10 @@
{
using namespace boost::asio::ip;
- addrs.push_back(address_v4::from_string("129.82.100.1"));
- addrs.push_back(address_v6::from_string("2001:db8:1::1"));
- addrs.push_back(address_v4::from_string("192.168.2.1"));
- addrs.push_back(address_v6::from_string("2001:db8:2::1"));
+ addrs.emplace_back(make_address_v4("129.82.100.1"));
+ addrs.emplace_back(make_address_v6("2001:db8:1::1"));
+ addrs.emplace_back(make_address_v4("192.168.2.1"));
+ addrs.emplace_back(make_address_v6("2001:db8:2::1"));
}
protected:
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index fba95fe..e2aa73d 100644
--- a/tests/daemon/face/tcp-factory.t.cpp
+++ b/tests/daemon/face/tcp-factory.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -42,7 +42,7 @@
shared_ptr<TcpChannel>
createChannel(const std::string& localIp, const std::string& localPort)
{
- tcp::Endpoint endpoint(boost::asio::ip::address::from_string(localIp),
+ tcp::Endpoint endpoint(boost::asio::ip::make_address(localIp),
boost::lexical_cast<uint16_t>(localPort));
return factory.createChannel(endpoint);
}
diff --git a/tests/daemon/face/test-netif.cpp b/tests/daemon/face/test-netif.cpp
index 68b66cd..2dd9da5 100644
--- a/tests/daemon/face/test-netif.cpp
+++ b/tests/daemon/face/test-netif.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -37,7 +37,7 @@
if (netmon.getCapabilities() & NetworkMonitor::CAP_ENUM) {
netmon.onEnumerationCompleted.connect([] { getGlobalIoService().stop(); });
getGlobalIoService().run();
- getGlobalIoService().reset();
+ getGlobalIoService().restart();
}
return netmon.listNetworkInterfaces();
}
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index 259dbb3..106ba0b 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -42,7 +42,7 @@
shared_ptr<UdpChannel>
createChannel(const std::string& localIp, uint16_t localPort)
{
- udp::Endpoint endpoint(boost::asio::ip::address::from_string(localIp), localPort);
+ udp::Endpoint endpoint(boost::asio::ip::make_address(localIp), localPort);
return factory.createChannel(endpoint, 5_min);
}
};
@@ -75,8 +75,8 @@
shared_ptr<Face>
createMulticastFace(const std::string& localIp, const std::string& mcastIp, uint16_t mcastPort)
{
- auto localAddress = boost::asio::ip::address::from_string(localIp);
- udp::Endpoint mcastEndpoint(boost::asio::ip::address::from_string(mcastIp), mcastPort);
+ auto localAddress = boost::asio::ip::make_address(localIp);
+ udp::Endpoint mcastEndpoint(boost::asio::ip::make_address(mcastIp), mcastPort);
if (localAddress.is_v4()) {
BOOST_ASSERT(!netifsV4.empty());
@@ -129,7 +129,7 @@
static bool
isFaceOnNetif(const Face& face, const NetworkInterface& netif)
{
- auto ip = boost::asio::ip::address::from_string(face.getLocalUri().getHost());
+ auto ip = boost::asio::ip::make_address(face.getLocalUri().getHost());
return std::any_of(netif.getNetworkAddresses().begin(), netif.getNetworkAddresses().end(),
[ip] (const auto& a) { return a.getIp() == ip; });
}
@@ -427,9 +427,9 @@
auto uri = udpMcastFaces.front()->getRemoteUri();
BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
// check the address ignoring the scope id
- auto addr = boost::asio::ip::address_v6::from_string(uri.getHost());
+ auto addr = boost::asio::ip::make_address_v6(uri.getHost());
addr.scope_id(0);
- BOOST_CHECK_EQUAL(addr, boost::asio::ip::address_v6::from_string("ff02::1101"));
+ BOOST_CHECK_EQUAL(addr, boost::asio::ip::make_address_v6("ff02::1101"));
BOOST_CHECK_EQUAL(uri.getPort(), "7011");
parseConfig(CONFIG2, false);
@@ -439,9 +439,9 @@
uri = udpMcastFaces.front()->getRemoteUri();
BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
// check the address ignoring the scope id
- addr = boost::asio::ip::address_v6::from_string(uri.getHost());
+ addr = boost::asio::ip::make_address_v6(uri.getHost());
addr.scope_id(0);
- BOOST_CHECK_EQUAL(addr, boost::asio::ip::address_v6::from_string("ff02::1102"));
+ BOOST_CHECK_EQUAL(addr, boost::asio::ip::make_address_v6("ff02::1102"));
BOOST_CHECK_EQUAL(uri.getPort(), "7012");
}
diff --git a/tests/daemon/face/websocket-factory.t.cpp b/tests/daemon/face/websocket-factory.t.cpp
index aac1eca..c133671 100644
--- a/tests/daemon/face/websocket-factory.t.cpp
+++ b/tests/daemon/face/websocket-factory.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -41,7 +41,7 @@
shared_ptr<WebSocketChannel>
createChannel(const std::string& localIp, const std::string& localPort)
{
- websocket::Endpoint endpoint(boost::asio::ip::address::from_string(localIp),
+ websocket::Endpoint endpoint(boost::asio::ip::make_address(localIp),
boost::lexical_cast<uint16_t>(localPort));
return factory.createChannel(endpoint);
}
diff --git a/tests/daemon/face/websocket-transport.t.cpp b/tests/daemon/face/websocket-transport.t.cpp
index 23d15f0..d28d8a3 100644
--- a/tests/daemon/face/websocket-transport.t.cpp
+++ b/tests/daemon/face/websocket-transport.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -63,7 +63,7 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(StaticPropertiesV4Mapped, T, StaticPropertiesV4MappedFixtures, T)
{
TRANSPORT_TEST_CHECK_PRECONDITIONS();
- auto mappedAddr = ip::address_v6::v4_mapped(this->address.to_v4());
+ auto mappedAddr = ip::make_address_v6(ip::v4_mapped, this->address.to_v4());
BOOST_REQUIRE(mappedAddr.is_v4_mapped());
WebSocketTransportFixture::initialize(this->interface, mappedAddr);
diff --git a/tests/daemon/limited-io.cpp b/tests/daemon/limited-io.cpp
index 9f10f99..7b54190 100644
--- a/tests/daemon/limited-io.cpp
+++ b/tests/daemon/limited-io.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -70,7 +70,7 @@
m_lastException = std::current_exception();
}
- getGlobalIoService().reset();
+ getGlobalIoService().restart();
m_timeout.cancel();
m_isRunning = false;
diff --git a/tests/daemon/rib-io-fixture.cpp b/tests/daemon/rib-io-fixture.cpp
index d8931df..df67694 100644
--- a/tests/daemon/rib-io-fixture.cpp
+++ b/tests/daemon/rib-io-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -61,7 +61,7 @@
}
if (g_ribIo->stopped()) {
- g_ribIo->reset();
+ g_ribIo->restart();
}
while (g_ribIo->poll() > 0)
;
@@ -109,7 +109,7 @@
m_ribPollStartCv.notify_all();
if (g_io.stopped()) {
- g_io.reset();
+ g_io.restart();
}
nHandlersRun = g_io.poll();
diff --git a/tests/other/face-benchmark.cpp b/tests/other/face-benchmark.cpp
index a81ba2c..c5c666d 100644
--- a/tests/other/face-benchmark.cpp
+++ b/tests/other/face-benchmark.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -121,7 +121,7 @@
}
// create the right face
- auto addr = boost::asio::ip::address::from_string(uriR.getHost());
+ auto addr = boost::asio::ip::make_address(uriR.getHost());
auto port = boost::lexical_cast<uint16_t>(uriR.getPort());
if (uriR.getScheme() == "tcp4") {
m_tcpChannel.connect(tcp::Endpoint(addr, port), {},
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index 4876090..292ccc8 100644
--- a/tools/nfd-autoreg.cpp
+++ b/tools/nfd-autoreg.cpp
@@ -116,7 +116,7 @@
{
if (hasAllowedSchema(uri)) {
boost::system::error_code ec;
- auto address = boost::asio::ip::address::from_string(uri.getHost(), ec);
+ auto address = boost::asio::ip::make_address(uri.getHost(), ec);
if (!address.is_multicast()) {
// register all-face prefixes