core+face: avoid deprecated Boost.Asio interfaces
Change-Id: I07ec286531edf63f258babe1561b4da2a88edd10
This commit is contained in:
1 parent
5d64263dcb
commit
d91fe6d921
22 files changed
+126
-140
No files matched your search
+7
-7
@@ -48,7 +48,7 @@ const Network&
|
|||||||
Network::getMaxRangeV4()
|
Network::getMaxRangeV4()
|
||||||
{
|
{
|
||||||
using boost::asio::ip::address_v4;
|
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;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,9 +56,9 @@ const Network&
|
|||||||
Network::getMaxRangeV6()
|
Network::getMaxRangeV6()
|
||||||
{
|
{
|
||||||
using boost::asio::ip::address_v6;
|
using boost::asio::ip::address_v6;
|
||||||
static address_v6::bytes_type maxV6 = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
static const address_v6::bytes_type maxV6 = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
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 Network range{address_v6{}, address_v6{maxV6}};
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +96,8 @@ operator>>(std::istream& is, Network& network)
|
|||||||
size_t position = networkStr.find('/');
|
size_t position = networkStr.find('/');
|
||||||
if (position == std::string::npos) {
|
if (position == std::string::npos) {
|
||||||
try {
|
try {
|
||||||
network.m_minAddress = ip::address::from_string(networkStr);
|
network.m_minAddress = ip::make_address(networkStr);
|
||||||
network.m_maxAddress = ip::address::from_string(networkStr);
|
network.m_maxAddress = ip::make_address(networkStr);
|
||||||
}
|
}
|
||||||
catch (const boost::system::system_error&) {
|
catch (const boost::system::system_error&) {
|
||||||
is.setstate(std::ios::failbit);
|
is.setstate(std::ios::failbit);
|
||||||
@@ -106,7 +106,7 @@ operator>>(std::istream& is, Network& network)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boost::system::error_code ec;
|
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) {
|
if (ec) {
|
||||||
is.setstate(std::ios::failbit);
|
is.setstate(std::ios::failbit);
|
||||||
return is;
|
return is;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ StreamTransport<T>::doClose()
|
|||||||
// Use the non-throwing variants and ignore errors, if any.
|
// Use the non-throwing variants and ignore errors, if any.
|
||||||
boost::system::error_code error;
|
boost::system::error_code error;
|
||||||
m_socket.cancel(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
|
// Ensure that the Transport stays alive at least until
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -52,7 +52,7 @@ TcpChannel::TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMa
|
|||||||
void
|
void
|
||||||
TcpChannel::listen(const FaceCreatedCallback& onFaceCreated,
|
TcpChannel::listen(const FaceCreatedCallback& onFaceCreated,
|
||||||
const FaceCreationFailedCallback& onAcceptFailed,
|
const FaceCreationFailedCallback& onAcceptFailed,
|
||||||
int backlog/* = tcp::acceptor::max_connections*/)
|
int backlog)
|
||||||
{
|
{
|
||||||
if (isListening()) {
|
if (isListening()) {
|
||||||
NFD_LOG_CHAN_WARN("Already listening");
|
NFD_LOG_CHAN_WARN("Already listening");
|
||||||
@@ -150,7 +150,7 @@ TcpChannel::createFace(ip::tcp::socket&& socket,
|
|||||||
NFD_LOG_CHAN_TRACE("Reusing existing face for " << remoteEndpoint);
|
NFD_LOG_CHAN_TRACE("Reusing existing face for " << remoteEndpoint);
|
||||||
|
|
||||||
boost::system::error_code error;
|
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);
|
socket.close(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -40,20 +40,19 @@ using DetermineFaceScopeFromAddress = std::function<ndn::nfd::FaceScope(const bo
|
|||||||
const boost::asio::ip::address& remote)>;
|
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
|
* The channel can create faces as a response to incoming TCP connections (TcpChannel::listen()
|
||||||
* connections (TcpChannel::listen needs to be called for that
|
* needs to be called for that to work) or explicitly by using TcpChannel::connect().
|
||||||
* to work) or explicitly after using TcpChannel::connect method.
|
|
||||||
*/
|
*/
|
||||||
class TcpChannel final : public Channel
|
class TcpChannel final : public Channel
|
||||||
{
|
{
|
||||||
public:
|
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,
|
* To enable the creation of faces upon incoming connections, one needs to
|
||||||
* one needs to explicitly call TcpChannel::listen method.
|
* explicitly call listen().
|
||||||
*/
|
*/
|
||||||
TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMarking,
|
TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMarking,
|
||||||
DetermineFaceScopeFromAddress determineFaceScope);
|
DetermineFaceScopeFromAddress determineFaceScope);
|
||||||
@@ -72,7 +71,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Enable listening on the local endpoint, accept connections,
|
* \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 onFaceCreated Callback to notify successful creation of the face
|
||||||
* \param onAcceptFailed Callback to notify when channel fails (accept call
|
* \param onAcceptFailed Callback to notify when channel fails (accept call
|
||||||
* returns an error)
|
* returns an error)
|
||||||
@@ -82,10 +81,10 @@ public:
|
|||||||
void
|
void
|
||||||
listen(const FaceCreatedCallback& onFaceCreated,
|
listen(const FaceCreatedCallback& onFaceCreated,
|
||||||
const FaceCreationFailedCallback& onAcceptFailed,
|
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
|
void
|
||||||
connect(const tcp::Endpoint& remoteEndpoint,
|
connect(const tcp::Endpoint& remoteEndpoint,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -163,7 +163,7 @@ TcpFactory::doCreateFace(const CreateFaceRequest& req,
|
|||||||
return;
|
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()));
|
boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
|
||||||
|
|
||||||
// a canonical tcp4/tcp6 FaceUri cannot have a multicast address
|
// a canonical tcp4/tcp6 FaceUri cannot have a multicast address
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -129,7 +129,7 @@ UdpFactory::doProcessConfig(OptionalConfigSection configSection,
|
|||||||
else if (key == "mcast_group") {
|
else if (key == "mcast_group") {
|
||||||
const std::string& valueStr = value.get_value<std::string>();
|
const std::string& valueStr = value.get_value<std::string>();
|
||||||
boost::system::error_code ec;
|
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) {
|
if (ec) {
|
||||||
NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group: '" +
|
NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group: '" +
|
||||||
valueStr + "' cannot be parsed as an IPv4 address"));
|
valueStr + "' cannot be parsed as an IPv4 address"));
|
||||||
@@ -145,7 +145,7 @@ UdpFactory::doProcessConfig(OptionalConfigSection configSection,
|
|||||||
else if (key == "mcast_group_v6") {
|
else if (key == "mcast_group_v6") {
|
||||||
const std::string& valueStr = value.get_value<std::string>();
|
const std::string& valueStr = value.get_value<std::string>();
|
||||||
boost::system::error_code ec;
|
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) {
|
if (ec) {
|
||||||
NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
|
NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
|
||||||
valueStr + "' cannot be parsed as an IPv6 address"));
|
valueStr + "' cannot be parsed as an IPv6 address"));
|
||||||
@@ -261,7 +261,7 @@ UdpFactory::doCreateFace(const CreateFaceRequest& req,
|
|||||||
return;
|
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()));
|
boost::lexical_cast<uint16_t>(req.remoteUri.getPort()));
|
||||||
|
|
||||||
if (endpoint.address().is_multicast()) {
|
if (endpoint.address().is_multicast()) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -46,7 +46,7 @@ computeMtu(const Endpoint& localEndpoint);
|
|||||||
inline Endpoint
|
inline Endpoint
|
||||||
getDefaultMulticastGroup()
|
getDefaultMulticastGroup()
|
||||||
{
|
{
|
||||||
return {boost::asio::ip::address_v4(0xE00017AA), 56363};
|
return {boost::asio::ip::make_address_v4(0xE00017AA), 56363};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,7 @@ getDefaultMulticastGroup()
|
|||||||
inline Endpoint
|
inline Endpoint
|
||||||
getDefaultMulticastGroupV6()
|
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
|
} // namespace nfd::udp
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -63,7 +63,7 @@ UnixStreamChannel::~UnixStreamChannel()
|
|||||||
void
|
void
|
||||||
UnixStreamChannel::listen(const FaceCreatedCallback& onFaceCreated,
|
UnixStreamChannel::listen(const FaceCreatedCallback& onFaceCreated,
|
||||||
const FaceCreationFailedCallback& onAcceptFailed,
|
const FaceCreationFailedCallback& onAcceptFailed,
|
||||||
int backlog/* = acceptor::max_connections*/)
|
int backlog)
|
||||||
{
|
{
|
||||||
if (isListening()) {
|
if (isListening()) {
|
||||||
NFD_LOG_CHAN_WARN("Already listening");
|
NFD_LOG_CHAN_WARN("Already listening");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -37,16 +37,16 @@ using Endpoint = boost::asio::local::stream_protocol::endpoint;
|
|||||||
namespace nfd::face {
|
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
|
* 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
|
class UnixStreamChannel final : public Channel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* \brief UnixStreamChannel-related error
|
* \brief UnixStreamChannel-related error.
|
||||||
*/
|
*/
|
||||||
class Error : public std::runtime_error
|
class Error : public std::runtime_error
|
||||||
{
|
{
|
||||||
@@ -55,10 +55,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \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
|
* To enable the creation of faces upon incoming connections, one needs to
|
||||||
* needs to explicitly call UnixStreamChannel::listen method.
|
* explicitly call listen().
|
||||||
*/
|
*/
|
||||||
UnixStreamChannel(const unix_stream::Endpoint& endpoint, bool wantCongestionMarking);
|
UnixStreamChannel(const unix_stream::Endpoint& endpoint, bool wantCongestionMarking);
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Start listening
|
* \brief Start listening.
|
||||||
*
|
*
|
||||||
* Enable listening on the Unix socket, waiting for incoming connections,
|
* Enable listening on the Unix socket, waiting for incoming connections,
|
||||||
* and creating a face when a connection is made.
|
* and creating a face when a connection is made.
|
||||||
@@ -94,7 +94,7 @@ public:
|
|||||||
void
|
void
|
||||||
listen(const FaceCreatedCallback& onFaceCreated,
|
listen(const FaceCreatedCallback& onFaceCreated,
|
||||||
const FaceCreationFailedCallback& onAcceptFailed,
|
const FaceCreationFailedCallback& onAcceptFailed,
|
||||||
int backlog = boost::asio::local::stream_protocol::acceptor::max_connections);
|
int backlog = boost::asio::socket_base::max_listen_connections);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -36,12 +36,13 @@ isLoopback(const boost::asio::ip::address& addr)
|
|||||||
if (addr.is_loopback()) {
|
if (addr.is_loopback()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workaround for loopback IPv4-mapped IPv6 addresses
|
// Workaround for loopback IPv4-mapped IPv6 addresses
|
||||||
// see https://svn.boost.org/trac/boost/ticket/9084
|
// see https://svn.boost.org/trac/boost/ticket/9084
|
||||||
else if (addr.is_v6()) {
|
if (addr.is_v6()) {
|
||||||
auto addr6 = addr.to_v6();
|
auto addr6 = addr.to_v6();
|
||||||
if (addr6.is_v4_mapped()) {
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-54
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -31,38 +31,34 @@
|
|||||||
|
|
||||||
namespace nfd::tests {
|
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)
|
BOOST_AUTO_TEST_CASE(Empty)
|
||||||
{
|
{
|
||||||
Network n;
|
Network n;
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:0:3025:ccc5:eeeb:86d3")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:0:3025:ccc5:eeeb:86d3")), false);
|
||||||
false);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("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("255.255.255.255")), false);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MaxRangeV4)
|
BOOST_AUTO_TEST_CASE(MaxRangeV4)
|
||||||
{
|
{
|
||||||
Network n = Network::getMaxRangeV4();
|
Network n = Network::getMaxRangeV4();
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), true);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), true);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), false);
|
||||||
false);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), true);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("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("255.255.255.255")), true);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(RangeV4)
|
BOOST_AUTO_TEST_CASE(RangeV4)
|
||||||
@@ -73,35 +69,31 @@ BOOST_AUTO_TEST_CASE(RangeV4)
|
|||||||
BOOST_CHECK_THROW(boost::lexical_cast<Network>("192.0.2.0/255"), boost::bad_lexical_cast);
|
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_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(ip::make_address("192.0.2.1")), true);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.254")), true);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.254")), true);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.1.255")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("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.3.0")), false);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), false);
|
||||||
false);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("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("255.255.255.255")), false);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MaxRangeV6)
|
BOOST_AUTO_TEST_CASE(MaxRangeV6)
|
||||||
{
|
{
|
||||||
Network n = Network::getMaxRangeV6();
|
Network n = Network::getMaxRangeV6();
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("192.0.2.1")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("192.0.2.1")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), true);
|
||||||
true);
|
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("0.0.0.1")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("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("255.255.255.255")), false);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), true);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), true);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), true);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(RangeV6)
|
BOOST_AUTO_TEST_CASE(RangeV6)
|
||||||
@@ -114,24 +106,18 @@ BOOST_AUTO_TEST_CASE(RangeV6)
|
|||||||
BOOST_CHECK_THROW(boost::lexical_cast<Network>("200x:db8:3f9:1::/64"), boost::bad_lexical_cast);
|
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_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(ip::make_address("192.0.2.1")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:3025:ccc5:eeeb:86d3")), true);
|
||||||
true);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1::")), true);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1::")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:1:ffff:ffff:ffff:ffff")), true);
|
||||||
true);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:0:ffff:ffff:ffff:ffff")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("2001:db8:3f9:1:ffff:ffff:ffff:ffff")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("2001:db8:3f9:2::")), false);
|
||||||
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(address::from_string("0.0.0.1")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("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("255.255.255.255")), false);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("::")), false);
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("::")), false);
|
||||||
BOOST_CHECK_EQUAL(n.doesContain(address::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")),
|
BOOST_CHECK_EQUAL(n.doesContain(ip::make_address("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")), false);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(Comparisons)
|
BOOST_AUTO_TEST_CASE(Comparisons)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -49,11 +49,11 @@ protected:
|
|||||||
ip::address mcastAddr;
|
ip::address mcastAddr;
|
||||||
if (address.is_v4()) {
|
if (address.is_v4()) {
|
||||||
// the administratively scoped group 224.0.0.254 is reserved for experimentation (RFC 4727)
|
// 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 {
|
else {
|
||||||
// the group FF0X::114 is reserved for experimentation at all scope levels (RFC 4727)
|
// 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());
|
v6Addr.scope_id(netif->getIndex());
|
||||||
mcastAddr = v6Addr;
|
mcastAddr = v6Addr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -69,19 +69,19 @@ class NetworkInterfacePredicateFixture : public NetworkPredicateBaseFixture<face
|
|||||||
protected:
|
protected:
|
||||||
NetworkInterfacePredicateFixture()
|
NetworkInterfacePredicateFixture()
|
||||||
{
|
{
|
||||||
using namespace boost::asio::ip;
|
|
||||||
using namespace ndn::net;
|
using namespace ndn::net;
|
||||||
namespace ethernet = ndn::ethernet;
|
namespace ethernet = ndn::ethernet;
|
||||||
|
namespace ip = boost::asio::ip;
|
||||||
|
|
||||||
netifs.push_back(NetworkMonitorStub::makeNetworkInterface());
|
netifs.push_back(NetworkMonitorStub::makeNetworkInterface());
|
||||||
netifs.back()->setIndex(0);
|
netifs.back()->setIndex(0);
|
||||||
netifs.back()->setName("eth0");
|
netifs.back()->setName("eth0");
|
||||||
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:00"));
|
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:00"));
|
||||||
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
|
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));
|
16, AddressScope::GLOBAL, 0));
|
||||||
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V6,
|
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));
|
64, AddressScope::GLOBAL, 0));
|
||||||
netifs.back()->setFlags(IFF_UP);
|
netifs.back()->setFlags(IFF_UP);
|
||||||
|
|
||||||
@@ -90,10 +90,10 @@ protected:
|
|||||||
netifs.back()->setName("eth1");
|
netifs.back()->setName("eth1");
|
||||||
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:01"));
|
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:01"));
|
||||||
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
|
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));
|
24, AddressScope::GLOBAL, 0));
|
||||||
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V6,
|
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));
|
64, AddressScope::GLOBAL, 0));
|
||||||
netifs.back()->setFlags(IFF_UP);
|
netifs.back()->setFlags(IFF_UP);
|
||||||
|
|
||||||
@@ -102,10 +102,10 @@ protected:
|
|||||||
netifs.back()->setName("eth2");
|
netifs.back()->setName("eth2");
|
||||||
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:02"));
|
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:02"));
|
||||||
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
|
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));
|
24, AddressScope::GLOBAL, 0));
|
||||||
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V6,
|
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));
|
112, AddressScope::GLOBAL, 0));
|
||||||
netifs.back()->setFlags(IFF_MULTICAST | IFF_BROADCAST | IFF_UP);
|
netifs.back()->setFlags(IFF_MULTICAST | IFF_BROADCAST | IFF_UP);
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ protected:
|
|||||||
netifs.back()->setName("enp68s0f1");
|
netifs.back()->setName("enp68s0f1");
|
||||||
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:03"));
|
netifs.back()->setEthernetAddress(ethernet::Address::fromString("3e:15:c2:8b:65:03"));
|
||||||
netifs.back()->addNetworkAddress(NetworkAddress(AddressFamily::V4,
|
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));
|
24, AddressScope::GLOBAL, 0));
|
||||||
netifs.back()->setFlags(IFF_UP);
|
netifs.back()->setFlags(IFF_UP);
|
||||||
}
|
}
|
||||||
@@ -382,10 +382,10 @@ protected:
|
|||||||
{
|
{
|
||||||
using namespace boost::asio::ip;
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
addrs.push_back(address_v4::from_string("129.82.100.1"));
|
addrs.emplace_back(make_address_v4("129.82.100.1"));
|
||||||
addrs.push_back(address_v6::from_string("2001:db8:1::1"));
|
addrs.emplace_back(make_address_v6("2001:db8:1::1"));
|
||||||
addrs.push_back(address_v4::from_string("192.168.2.1"));
|
addrs.emplace_back(make_address_v4("192.168.2.1"));
|
||||||
addrs.push_back(address_v6::from_string("2001:db8:2::1"));
|
addrs.emplace_back(make_address_v6("2001:db8:2::1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -42,7 +42,7 @@ protected:
|
|||||||
shared_ptr<TcpChannel>
|
shared_ptr<TcpChannel>
|
||||||
createChannel(const std::string& localIp, const std::string& localPort)
|
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));
|
boost::lexical_cast<uint16_t>(localPort));
|
||||||
return factory.createChannel(endpoint);
|
return factory.createChannel(endpoint);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -37,7 +37,7 @@ enumerateNetworkInterfaces(NetworkMonitor& netmon)
|
|||||||
if (netmon.getCapabilities() & NetworkMonitor::CAP_ENUM) {
|
if (netmon.getCapabilities() & NetworkMonitor::CAP_ENUM) {
|
||||||
netmon.onEnumerationCompleted.connect([] { getGlobalIoService().stop(); });
|
netmon.onEnumerationCompleted.connect([] { getGlobalIoService().stop(); });
|
||||||
getGlobalIoService().run();
|
getGlobalIoService().run();
|
||||||
getGlobalIoService().reset();
|
getGlobalIoService().restart();
|
||||||
}
|
}
|
||||||
return netmon.listNetworkInterfaces();
|
return netmon.listNetworkInterfaces();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -42,7 +42,7 @@ protected:
|
|||||||
shared_ptr<UdpChannel>
|
shared_ptr<UdpChannel>
|
||||||
createChannel(const std::string& localIp, uint16_t localPort)
|
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);
|
return factory.createChannel(endpoint, 5_min);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -75,8 +75,8 @@ protected:
|
|||||||
shared_ptr<Face>
|
shared_ptr<Face>
|
||||||
createMulticastFace(const std::string& localIp, const std::string& mcastIp, uint16_t mcastPort)
|
createMulticastFace(const std::string& localIp, const std::string& mcastIp, uint16_t mcastPort)
|
||||||
{
|
{
|
||||||
auto localAddress = boost::asio::ip::address::from_string(localIp);
|
auto localAddress = boost::asio::ip::make_address(localIp);
|
||||||
udp::Endpoint mcastEndpoint(boost::asio::ip::address::from_string(mcastIp), mcastPort);
|
udp::Endpoint mcastEndpoint(boost::asio::ip::make_address(mcastIp), mcastPort);
|
||||||
|
|
||||||
if (localAddress.is_v4()) {
|
if (localAddress.is_v4()) {
|
||||||
BOOST_ASSERT(!netifsV4.empty());
|
BOOST_ASSERT(!netifsV4.empty());
|
||||||
@@ -129,7 +129,7 @@ protected:
|
|||||||
static bool
|
static bool
|
||||||
isFaceOnNetif(const Face& face, const NetworkInterface& netif)
|
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(),
|
return std::any_of(netif.getNetworkAddresses().begin(), netif.getNetworkAddresses().end(),
|
||||||
[ip] (const auto& a) { return a.getIp() == ip; });
|
[ip] (const auto& a) { return a.getIp() == ip; });
|
||||||
}
|
}
|
||||||
@@ -427,9 +427,9 @@ BOOST_FIXTURE_TEST_CASE(ChangeMcastEndpointV6, UdpFactoryMcastFixture)
|
|||||||
auto uri = udpMcastFaces.front()->getRemoteUri();
|
auto uri = udpMcastFaces.front()->getRemoteUri();
|
||||||
BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
|
BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
|
||||||
// check the address ignoring the scope id
|
// 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);
|
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");
|
BOOST_CHECK_EQUAL(uri.getPort(), "7011");
|
||||||
|
|
||||||
parseConfig(CONFIG2, false);
|
parseConfig(CONFIG2, false);
|
||||||
@@ -439,9 +439,9 @@ BOOST_FIXTURE_TEST_CASE(ChangeMcastEndpointV6, UdpFactoryMcastFixture)
|
|||||||
uri = udpMcastFaces.front()->getRemoteUri();
|
uri = udpMcastFaces.front()->getRemoteUri();
|
||||||
BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
|
BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
|
||||||
// check the address ignoring the scope id
|
// 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);
|
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");
|
BOOST_CHECK_EQUAL(uri.getPort(), "7012");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -41,7 +41,7 @@ protected:
|
|||||||
shared_ptr<WebSocketChannel>
|
shared_ptr<WebSocketChannel>
|
||||||
createChannel(const std::string& localIp, const std::string& localPort)
|
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));
|
boost::lexical_cast<uint16_t>(localPort));
|
||||||
return factory.createChannel(endpoint);
|
return factory.createChannel(endpoint);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -63,7 +63,7 @@ using StaticPropertiesV4MappedFixtures = boost::mpl::vector<
|
|||||||
BOOST_FIXTURE_TEST_CASE_TEMPLATE(StaticPropertiesV4Mapped, T, StaticPropertiesV4MappedFixtures, T)
|
BOOST_FIXTURE_TEST_CASE_TEMPLATE(StaticPropertiesV4Mapped, T, StaticPropertiesV4MappedFixtures, T)
|
||||||
{
|
{
|
||||||
TRANSPORT_TEST_CHECK_PRECONDITIONS();
|
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());
|
BOOST_REQUIRE(mappedAddr.is_v4_mapped());
|
||||||
WebSocketTransportFixture::initialize(this->interface, mappedAddr);
|
WebSocketTransportFixture::initialize(this->interface, mappedAddr);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -70,7 +70,7 @@ LimitedIo::run(int nOpsLimit, time::nanoseconds timeLimit, time::nanoseconds tic
|
|||||||
m_lastException = std::current_exception();
|
m_lastException = std::current_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
getGlobalIoService().reset();
|
getGlobalIoService().restart();
|
||||||
m_timeout.cancel();
|
m_timeout.cancel();
|
||||||
m_isRunning = false;
|
m_isRunning = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -61,7 +61,7 @@ RibIoFixture::RibIoFixture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_ribIo->stopped()) {
|
if (g_ribIo->stopped()) {
|
||||||
g_ribIo->reset();
|
g_ribIo->restart();
|
||||||
}
|
}
|
||||||
while (g_ribIo->poll() > 0)
|
while (g_ribIo->poll() > 0)
|
||||||
;
|
;
|
||||||
@@ -109,7 +109,7 @@ RibIoFixture::poll()
|
|||||||
m_ribPollStartCv.notify_all();
|
m_ribPollStartCv.notify_all();
|
||||||
|
|
||||||
if (g_io.stopped()) {
|
if (g_io.stopped()) {
|
||||||
g_io.reset();
|
g_io.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
nHandlersRun = g_io.poll();
|
nHandlersRun = g_io.poll();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
/* -*- 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,
|
* Arizona Board of Regents,
|
||||||
* Colorado State University,
|
* Colorado State University,
|
||||||
* University Pierre & Marie Curie, Sorbonne University,
|
* University Pierre & Marie Curie, Sorbonne University,
|
||||||
@@ -121,7 +121,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create the right face
|
// 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());
|
auto port = boost::lexical_cast<uint16_t>(uriR.getPort());
|
||||||
if (uriR.getScheme() == "tcp4") {
|
if (uriR.getScheme() == "tcp4") {
|
||||||
m_tcpChannel.connect(tcp::Endpoint(addr, port), {},
|
m_tcpChannel.connect(tcp::Endpoint(addr, port), {},
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (hasAllowedSchema(uri)) {
|
if (hasAllowedSchema(uri)) {
|
||||||
boost::system::error_code ec;
|
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()) {
|
if (!address.is_multicast()) {
|
||||||
// register all-face prefixes
|
// register all-face prefixes
|
||||||
|
|||||||
Reference in new issue
Block a user