face: use NetworkMonitor::listNetworkInterfaces() in tests
refs #4021
Change-Id: I6daccc3872a0c6b2e2e49390bc5881c796503926
diff --git a/tests/daemon/face/ethernet-channel.t.cpp b/tests/daemon/face/ethernet-channel.t.cpp
index af9f788..78f5015 100644
--- a/tests/daemon/face/ethernet-channel.t.cpp
+++ b/tests/daemon/face/ethernet-channel.t.cpp
@@ -38,7 +38,7 @@
makeChannel()
{
BOOST_ASSERT(netifs.size() > 0);
- return make_unique<EthernetChannel>(netifs.front().asNetworkInterface(), time::seconds(2));
+ return make_unique<EthernetChannel>(netifs.front(), time::seconds(2));
}
};
@@ -50,7 +50,7 @@
SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
auto channel = makeChannel();
- BOOST_CHECK_EQUAL(channel->getUri(), FaceUri::fromDev(netifs.front().name));
+ BOOST_CHECK_EQUAL(channel->getUri(), FaceUri::fromDev(netifs.front()->getName()));
}
BOOST_AUTO_TEST_CASE(Listen)
diff --git a/tests/daemon/face/ethernet-factory.t.cpp b/tests/daemon/face/ethernet-factory.t.cpp
index b83e331..856a942 100644
--- a/tests/daemon/face/ethernet-factory.t.cpp
+++ b/tests/daemon/face/ethernet-factory.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -195,12 +195,12 @@
}
}
)CONFIG";
- boost::replace_first(CONFIG, "%ifname", netifs.front().name);
+ boost::replace_first(CONFIG, "%ifname", netifs.front()->getName());
parseConfig(CONFIG, false);
auto etherMcastFaces = this->listEtherMcastFaces();
BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), 1);
- BOOST_CHECK_EQUAL(etherMcastFaces.front()->getLocalUri().getHost(), netifs.front().name);
+ BOOST_CHECK_EQUAL(etherMcastFaces.front()->getLocalUri().getHost(), netifs.front()->getName());
}
BOOST_AUTO_TEST_CASE(Blacklist)
@@ -219,13 +219,13 @@
}
}
)CONFIG";
- boost::replace_first(CONFIG, "%ifname", netifs.front().name);
+ boost::replace_first(CONFIG, "%ifname", netifs.front()->getName());
parseConfig(CONFIG, false);
auto etherMcastFaces = this->listEtherMcastFaces();
BOOST_CHECK_EQUAL(etherMcastFaces.size(), netifs.size() - 1);
BOOST_CHECK_EQUAL(boost::count_if(etherMcastFaces, [=] (const Face* face) {
- return face->getLocalUri().getHost() == netifs.front().name;
+ return face->getLocalUri().getHost() == netifs.front()->getName();
}), 0);
}
diff --git a/tests/daemon/face/ethernet-fixture.hpp b/tests/daemon/face/ethernet-fixture.hpp
index c1f2b8e..334fe21 100644
--- a/tests/daemon/face/ethernet-fixture.hpp
+++ b/tests/daemon/face/ethernet-fixture.hpp
@@ -26,11 +26,11 @@
#ifndef NFD_TESTS_DAEMON_FACE_ETHERNET_FIXTURE_HPP
#define NFD_TESTS_DAEMON_FACE_ETHERNET_FIXTURE_HPP
-#include "core/network-interface.hpp"
#include "face/multicast-ethernet-transport.hpp"
#include "face/unicast-ethernet-transport.hpp"
#include "tests/limited-io.hpp"
+#include "test-netif-ip.hpp"
namespace nfd {
namespace face {
@@ -38,16 +38,17 @@
using namespace nfd::tests;
+/** \brief a fixture providing a list of EthernetTransport-capable network interfaces
+ */
class EthernetFixture : public virtual BaseFixture
{
protected:
EthernetFixture()
{
- for (const auto& netif : listNetworkInterfaces()) {
- if (!netif.isLoopback() && netif.isUp()) {
+ for (const auto& netif : collectNetworkInterfaces()) {
+ if (!netif->isLoopback() && netif->isUp()) {
try {
- MulticastEthernetTransport transport(*netif.asNetworkInterface(),
- ethernet::getBroadcastAddress(),
+ MulticastEthernetTransport transport(*netif, ethernet::getBroadcastAddress(),
ndn::nfd::LINK_TYPE_MULTI_ACCESS);
netifs.push_back(netif);
}
@@ -58,37 +59,40 @@
}
}
+ /** \brief create a UnicastEthernetTransport
+ */
void
initializeUnicast(ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
ethernet::Address remoteAddr = {0x00, 0x00, 0x5e, 0x00, 0x53, 0x5e})
{
BOOST_ASSERT(netifs.size() > 0);
- localEp = netifs.front().name;
+ localEp = netifs.front()->getName();
remoteEp = remoteAddr;
- transport = make_unique<UnicastEthernetTransport>(*netifs.front().asNetworkInterface(),
- remoteEp, persistency, time::seconds(2));
+ transport = make_unique<UnicastEthernetTransport>(*netifs.front(), remoteEp, persistency, time::seconds(2));
}
+ /** \brief create a MulticastEthernetTransport
+ */
void
initializeMulticast(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS,
ethernet::Address mcastGroup = {0x01, 0x00, 0x5e, 0x90, 0x10, 0x5e})
{
BOOST_ASSERT(netifs.size() > 0);
- localEp = netifs.front().name;
+ localEp = netifs.front()->getName();
remoteEp = mcastGroup;
- transport = make_unique<MulticastEthernetTransport>(*netifs.front().asNetworkInterface(),
- remoteEp, linkType);
+ transport = make_unique<MulticastEthernetTransport>(*netifs.front(), remoteEp, linkType);
}
protected:
LimitedIo limitedIo;
- unique_ptr<EthernetTransport> transport;
- std::string localEp;
- ethernet::Address remoteEp;
/** \brief EthernetTransport-capable network interfaces
*/
- std::vector<NetworkInterfaceInfo> netifs;
+ std::vector<shared_ptr<const ndn::net::NetworkInterface>> netifs;
+
+ unique_ptr<EthernetTransport> transport;
+ std::string localEp;
+ ethernet::Address remoteEp;
};
#define SKIP_IF_ETHERNET_NETIF_COUNT_LT(n) \
diff --git a/tests/daemon/face/multicast-udp-transport-fixture.hpp b/tests/daemon/face/multicast-udp-transport-fixture.hpp
index 574cb58..00a9451 100644
--- a/tests/daemon/face/multicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/multicast-udp-transport-fixture.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -30,7 +30,7 @@
#include "face/face.hpp"
#include "dummy-receive-link-service.hpp"
-#include "test-ip.hpp"
+#include "test-netif-ip.hpp"
#include "tests/limited-io.hpp"
namespace nfd {
@@ -47,7 +47,7 @@
MulticastUdpTransportFixture()
: transport(nullptr)
, multicastEp(ip::address::from_string("230.15.19.47"), 7070)
- , defaultAddr(getTestIp<ip::address_v4>(LoopbackAddress::No, MulticastInterface::Yes))
+ , defaultAddr(getTestIp<AddressFamily::V4>(LoopbackAddress::No, MulticastInterface::Yes))
, receivedPackets(nullptr)
, remoteSockRx(g_io)
, remoteSockTx(g_io)
diff --git a/tests/daemon/face/tcp-channel.t.cpp b/tests/daemon/face/tcp-channel.t.cpp
index 986d471..d1a9626 100644
--- a/tests/daemon/face/tcp-channel.t.cpp
+++ b/tests/daemon/face/tcp-channel.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -25,8 +25,7 @@
#include "tcp-channel-fixture.hpp"
-#include "test-ip.hpp"
-
+#include "test-netif-ip.hpp"
#include <boost/mpl/vector.hpp>
namespace nfd {
@@ -36,16 +35,17 @@
BOOST_AUTO_TEST_SUITE(Face)
BOOST_FIXTURE_TEST_SUITE(TestTcpChannel, TcpChannelFixture)
-using AddressFamilies = boost::mpl::vector<boost::asio::ip::address_v4,
- boost::asio::ip::address_v6>;
+using AddressFamilies = boost::mpl::vector<
+ std::integral_constant<AddressFamily, AddressFamily::V4>,
+ std::integral_constant<AddressFamily, AddressFamily::V6>>;
-BOOST_AUTO_TEST_CASE_TEMPLATE(ConnectTimeout, A, AddressFamilies)
+BOOST_AUTO_TEST_CASE_TEMPLATE(ConnectTimeout, F, AddressFamilies)
{
- auto address = getTestIp<A>(LoopbackAddress::Yes);
+ auto address = getTestIp<F::value>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
// do not listen
- auto channel = this->makeChannel(A());
+ auto channel = this->makeChannel(typename IpAddressFromFamily<F::value>::type());
channel->connect(tcp::Endpoint(address, 7040),
ndn::nfd::FACE_PERSISTENCY_PERSISTENT, false,
[this] (const shared_ptr<nfd::Face>&) {
diff --git a/tests/daemon/face/tcp-transport-fixture.hpp b/tests/daemon/face/tcp-transport-fixture.hpp
index 08f55b6..b792e9c 100644
--- a/tests/daemon/face/tcp-transport-fixture.hpp
+++ b/tests/daemon/face/tcp-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,7 +30,7 @@
#include "face/face.hpp"
#include "dummy-receive-link-service.hpp"
-#include "test-ip.hpp"
+#include "test-netif-ip.hpp"
#include "tests/limited-io.hpp"
namespace nfd {
diff --git a/tests/daemon/face/tcp-transport.t.cpp b/tests/daemon/face/tcp-transport.t.cpp
index 0d5578f..c2b0235 100644
--- a/tests/daemon/face/tcp-transport.t.cpp
+++ b/tests/daemon/face/tcp-transport.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -36,7 +36,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesLocalIpv4)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -52,7 +52,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesLocalIpv6)
{
- auto address = getTestIp<ip::address_v6>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V6>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -68,7 +68,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesNonLocalIpv4)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::No);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::No);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -86,7 +86,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesNonLocalIpv6)
{
- auto address = getTestIp<ip::address_v6>(LoopbackAddress::No);
+ auto address = getTestIp<AddressFamily::V6>(LoopbackAddress::No);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -104,7 +104,7 @@
BOOST_AUTO_TEST_CASE(PersistencyChange)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -115,7 +115,7 @@
BOOST_AUTO_TEST_CASE(PermanentReconnect)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address, ndn::nfd::FACE_PERSISTENCY_PERMANENT);
@@ -140,7 +140,7 @@
// when persistency is changed out of permanent while transport is DOWN,
// the transport immediately goes into FAILED state
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address, ndn::nfd::FACE_PERSISTENCY_PERMANENT);
@@ -206,7 +206,7 @@
BOOST_AUTO_TEST_CASE(PermanentReconnectWithExponentialBackoff)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
tcp::endpoint remoteEp(address, 7070);
diff --git a/tests/daemon/face/tcp-udp-channel.t.cpp b/tests/daemon/face/tcp-udp-channel.t.cpp
index 88d9cba..e568bd6 100644
--- a/tests/daemon/face/tcp-udp-channel.t.cpp
+++ b/tests/daemon/face/tcp-udp-channel.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -26,8 +26,7 @@
#include "tcp-channel-fixture.hpp"
#include "udp-channel-fixture.hpp"
-#include "test-ip.hpp"
-
+#include "test-netif-ip.hpp"
#include <boost/mpl/vector.hpp>
namespace nfd {
@@ -37,18 +36,19 @@
BOOST_AUTO_TEST_SUITE(Face)
BOOST_AUTO_TEST_SUITE(TestTcpUdpChannel)
-template<typename F, typename A>
+template<typename F, AddressFamily AF>
struct FixtureAndAddress
{
using Fixture = F;
- using Address = A;
+ static constexpr AddressFamily ADDRESS_FAMILY = AF;
+ using Address = typename IpAddressFromFamily<AF>::type;
};
using FixtureAndAddressList = boost::mpl::vector<
- FixtureAndAddress<TcpChannelFixture, boost::asio::ip::address_v4>,
- FixtureAndAddress<TcpChannelFixture, boost::asio::ip::address_v6>,
- FixtureAndAddress<UdpChannelFixture, boost::asio::ip::address_v4>,
- FixtureAndAddress<UdpChannelFixture, boost::asio::ip::address_v6>
+ FixtureAndAddress<TcpChannelFixture, AddressFamily::V4>,
+ FixtureAndAddress<TcpChannelFixture, AddressFamily::V6>,
+ FixtureAndAddress<UdpChannelFixture, AddressFamily::V4>,
+ FixtureAndAddress<UdpChannelFixture, AddressFamily::V6>
>;
BOOST_FIXTURE_TEST_CASE_TEMPLATE(Uri, T, FixtureAndAddressList, T::Fixture)
@@ -73,7 +73,7 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(MultipleAccepts, T, FixtureAndAddressList, T::Fixture)
{
- auto address = getTestIp<typename T::Address>(LoopbackAddress::Yes);
+ auto address = getTestIp<T::ADDRESS_FAMILY>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->listen(address);
@@ -125,7 +125,7 @@
BOOST_FIXTURE_TEST_CASE_TEMPLATE(FaceClosure, T, FixtureAndAddressList, T::Fixture)
{
- auto address = getTestIp<typename T::Address>(LoopbackAddress::Yes);
+ auto address = getTestIp<T::ADDRESS_FAMILY>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->listen(address);
diff --git a/tests/daemon/face/test-ip.cpp b/tests/daemon/face/test-ip.cpp
deleted file mode 100644
index a4cda7d..0000000
--- a/tests/daemon/face/test-ip.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "test-ip.hpp"
-
-#include "core/network-interface.hpp"
-
-namespace nfd {
-namespace tests {
-namespace {
-
-template<typename E>
-bool
-matchTristate(E e, bool b)
-{
- return (e == E::DontCare) ||
- (e == E::Yes && b) ||
- (e == E::No && !b);
-}
-
-} // unnamed namespace
-
-template<>
-boost::asio::ip::address_v4
-getTestIp(LoopbackAddress loopback, MulticastInterface mcast)
-{
- for (const auto& interface : listNetworkInterfaces()) {
- if (interface.isUp() &&
- matchTristate(loopback, interface.isLoopback()) &&
- matchTristate(mcast, interface.isMulticastCapable())) {
- for (const auto& address : interface.ipv4Addresses) {
- if (!address.is_unspecified() &&
- matchTristate(loopback, address.is_loopback())) {
- return address;
- }
- }
- }
- }
- return {};
-}
-
-template<>
-boost::asio::ip::address_v6
-getTestIp(LoopbackAddress loopback, MulticastInterface mcast)
-{
- for (const auto& interface : listNetworkInterfaces()) {
- if (interface.isUp() &&
- matchTristate(loopback, interface.isLoopback()) &&
- matchTristate(mcast, interface.isMulticastCapable())) {
- for (const auto& address : interface.ipv6Addresses) {
- if (!address.is_unspecified() &&
- !address.is_link_local() && // see #1428
- matchTristate(loopback, address.is_loopback())) {
- return address;
- }
- }
- }
- }
- return {};
-}
-
-} // namespace tests
-} // namespace nfd
diff --git a/tests/daemon/face/test-ip.hpp b/tests/daemon/face/test-ip.hpp
deleted file mode 100644
index 2aa6203..0000000
--- a/tests/daemon/face/test-ip.hpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_TESTS_DAEMON_FACE_TEST_IP_HPP
-#define NFD_TESTS_DAEMON_FACE_TEST_IP_HPP
-
-#include <boost/asio/ip/address_v4.hpp>
-#include <boost/asio/ip/address_v6.hpp>
-
-#define SKIP_IF_IP_UNAVAILABLE(address) \
- do { \
- if ((address).is_unspecified()) { \
- BOOST_WARN_MESSAGE(false, "skipping assertions that require a valid IP address"); \
- return; \
- } \
- } while (false)
-
-namespace nfd {
-namespace tests {
-
-enum class LoopbackAddress {
- No,
- Yes,
- DontCare,
- Default = Yes
-};
-
-enum class MulticastInterface {
- No,
- Yes,
- DontCare,
- Default = DontCare
-};
-
-/** \brief get an IP address for test purposes from any available network interface
- * \tparam A the address type, either boost::asio::ip::address_v4 or boost::asio::ip::address_v6
- * \param loopback specifies if the address can, must, or must not be a loopback address
- * \param mcast specifies if the address can, must, or must not be chosen from a multicast-capable interface
- * \return an IP address
- * \retval default-constructed A, if no appropriate address is available
- */
-template<typename A>
-A
-getTestIp(LoopbackAddress loopback = LoopbackAddress::Default,
- MulticastInterface mcast = MulticastInterface::Default);
-
-template<>
-boost::asio::ip::address_v4
-getTestIp(LoopbackAddress loopback, MulticastInterface mcast);
-
-template<>
-boost::asio::ip::address_v6
-getTestIp(LoopbackAddress loopback, MulticastInterface mcast);
-
-} // namespace tests
-} // namespace nfd
-
-#endif // NFD_TESTS_DAEMON_FACE_TEST_IP_HPP
diff --git a/tests/daemon/face/test-netif-ip.cpp b/tests/daemon/face/test-netif-ip.cpp
new file mode 100644
index 0000000..3471ba3
--- /dev/null
+++ b/tests/daemon/face/test-netif-ip.cpp
@@ -0,0 +1,122 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "test-netif-ip.hpp"
+#include "core/global-io.hpp"
+#include <ndn-cxx/net/network-monitor.hpp>
+
+namespace nfd {
+namespace tests {
+
+std::vector<shared_ptr<const NetworkInterface>>
+collectNetworkInterfaces(bool allowCached)
+{
+ using ndn::net::NetworkMonitor;
+
+ static std::vector<shared_ptr<const NetworkInterface>> cached;
+ // cached.empty() indicates there's no cached list of netifs.
+ // Although it could also mean a system without any network interface, this situation is rare
+ // because the loopback interface is present on almost all systems.
+
+ if (!allowCached || cached.empty()) {
+ NetworkMonitor netmon(getGlobalIoService());
+ if ((netmon.getCapabilities() & NetworkMonitor::CAP_ENUM) == 0) {
+ BOOST_THROW_EXCEPTION(NetworkMonitor::Error("NetworkMonitor::CAP_ENUM is unavailable"));
+ }
+
+ netmon.onEnumerationCompleted.connect([] { getGlobalIoService().stop(); });
+ getGlobalIoService().run();
+ getGlobalIoService().reset();
+
+ cached = netmon.listNetworkInterfaces();
+ }
+
+ return cached;
+}
+
+namespace {
+
+template<typename E>
+bool
+matchTristate(E e, bool b)
+{
+ return (e == E::DontCare) ||
+ (e == E::Yes && b) ||
+ (e == E::No && !b);
+}
+
+template<AddressFamily AF>
+typename IpAddressFromFamily<AF>::type
+fromIpAddress(const boost::asio::ip::address& a);
+
+template<>
+IpAddressFromFamily<AddressFamily::V4>::type
+fromIpAddress<AddressFamily::V4>(const boost::asio::ip::address& a)
+{
+ return a.to_v4();
+}
+
+template<>
+IpAddressFromFamily<AddressFamily::V6>::type
+fromIpAddress<AddressFamily::V6>(const boost::asio::ip::address& a)
+{
+ return a.to_v6();
+}
+
+} // unnamed namespace
+
+template<AddressFamily AF>
+typename IpAddressFromFamily<AF>::type
+getTestIp(LoopbackAddress loopback, MulticastInterface mcast)
+{
+ for (const auto& interface : collectNetworkInterfaces()) {
+ if (!interface->isUp() ||
+ !matchTristate(loopback, interface->isLoopback()) ||
+ !matchTristate(mcast, interface->canMulticast())) {
+ continue;
+ }
+ for (const auto& address : interface->getNetworkAddresses()) {
+ if (isAddressFamily<AF>(address) &&
+ !address.getIp().is_unspecified() &&
+ address.getScope() != ndn::net::AddressScope::NOWHERE &&
+ address.getScope() != ndn::net::AddressScope::LINK && // link-local addresses are not supported yet (#1428)
+ matchTristate(loopback, address.getIp().is_loopback())) {
+ return fromIpAddress<AF>(address.getIp());
+ }
+ }
+ }
+ return {};
+}
+
+template
+IpAddressFromFamily<AddressFamily::V4>::type
+getTestIp<AddressFamily::V4>(LoopbackAddress loopback, MulticastInterface mcast);
+
+template
+IpAddressFromFamily<AddressFamily::V6>::type
+getTestIp<AddressFamily::V6>(LoopbackAddress loopback, MulticastInterface mcast);
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/daemon/face/test-netif-ip.hpp b/tests/daemon/face/test-netif-ip.hpp
new file mode 100644
index 0000000..dc076d7
--- /dev/null
+++ b/tests/daemon/face/test-netif-ip.hpp
@@ -0,0 +1,144 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NFD_TESTS_DAEMON_FACE_TEST_NETIF_IP_HPP
+#define NFD_TESTS_DAEMON_FACE_TEST_NETIF_IP_HPP
+
+#include "core/common.hpp"
+#include <type_traits>
+#include <boost/asio/ip/address_v4.hpp>
+#include <boost/asio/ip/address_v6.hpp>
+#include <ndn-cxx/net/network-address.hpp>
+#include <ndn-cxx/net/network-interface.hpp>
+
+namespace nfd {
+namespace tests {
+
+using ndn::net::AddressFamily;
+using ndn::net::NetworkAddress;
+using ndn::net::NetworkInterface;
+
+// ---- network interface ----
+
+/** \brief Collect information about network interfaces
+ * \param allowCached if true, previously collected information can be returned
+ * \note This function is blocking if \p allowCached is false or no previous information exists
+ * \throw ndn::net::NetworkMonitor::Error NetworkMonitor::CAP_ENUM is unavailable
+ */
+std::vector<shared_ptr<const NetworkInterface>>
+collectNetworkInterfaces(bool allowCached = true);
+
+template<AddressFamily AF>
+bool
+isAddressFamily(const NetworkAddress& a)
+{
+ return a.getFamily() == AF;
+}
+
+template<AddressFamily AF>
+bool
+hasAddressFamily(const NetworkInterface& netif)
+{
+ return std::any_of(netif.getNetworkAddresses().begin(), netif.getNetworkAddresses().end(),
+ &isAddressFamily<AF>);
+}
+
+// ---- IP address ----
+
+enum class LoopbackAddress {
+ No,
+ Yes,
+ DontCare,
+ Default = Yes
+};
+
+enum class MulticastInterface {
+ No,
+ Yes,
+ DontCare,
+ Default = DontCare
+};
+
+/** \brief Derives IP address type from AddressFamily
+ */
+template<AddressFamily AF>
+struct IpAddressFromFamily;
+
+template<>
+struct IpAddressFromFamily<AddressFamily::V4>
+{
+ using type = boost::asio::ip::address_v4;
+};
+
+template<>
+struct IpAddressFromFamily<AddressFamily::V6>
+{
+ using type = boost::asio::ip::address_v6;
+};
+
+/** \brief Get an IP address from any available network interface
+ * \tparam F address family, either AddressFamily::V4 or AddressFamily::V6
+ * \param loopback specifies if the address can, must, or must not be a loopback address
+ * \param mcast specifies if the address can, must, or must not be chosen from a multicast-capable interface
+ * \return an IP address, either boost::asio::ip::address_v4 or boost::asio::ip::address_v6
+ * \retval unspecified address, if no appropriate address is available
+ */
+template<AddressFamily F>
+typename IpAddressFromFamily<F>::type
+getTestIp(LoopbackAddress loopback = LoopbackAddress::Default,
+ MulticastInterface mcast = MulticastInterface::Default);
+
+extern template
+IpAddressFromFamily<AddressFamily::V4>::type
+getTestIp<AddressFamily::V4>(LoopbackAddress loopback, MulticastInterface mcast);
+
+extern template
+IpAddressFromFamily<AddressFamily::V6>::type
+getTestIp<AddressFamily::V6>(LoopbackAddress loopback, MulticastInterface mcast);
+
+/** \brief Skip rest of the test case if \p address is unavailable
+ *
+ * This macro can be used in conjunction with \p nfd::tests::getTestIp in a test case. Example:
+ * \code
+ * BOOST_AUTO_TEST_CASE(TestCase)
+ * {
+ * auto ip = getTestIp<AddressFamily::V4>();
+ * SKIP_IF_IP_UNAVAILABLE(ip);
+ * // Test something that requires an IPv4 address.
+ * }
+ * \endcode
+ */
+#define SKIP_IF_IP_UNAVAILABLE(address) \
+ do { \
+ if ((address).is_unspecified()) { \
+ BOOST_WARN_MESSAGE(false, "skipping assertions that require a valid IP address"); \
+ return; \
+ } \
+ } while (false)
+
+} // namespace tests
+} // namespace nfd
+
+#endif // NFD_TESTS_DAEMON_FACE_TEST_NETIF_IP_HPP
diff --git a/tests/daemon/face/udp-factory.t.cpp b/tests/daemon/face/udp-factory.t.cpp
index d74ba69..b5ddb8a 100644
--- a/tests/daemon/face/udp-factory.t.cpp
+++ b/tests/daemon/face/udp-factory.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -28,6 +28,7 @@
#include "factory-test-common.hpp"
#include "face-system-fixture.hpp"
#include "tests/limited-io.hpp"
+#include "test-netif-ip.hpp"
#include <boost/algorithm/string/replace.hpp>
#include <boost/range/algorithm.hpp>
@@ -114,8 +115,8 @@
protected:
UdpMcastConfigFixture()
{
- for (const auto& netif : listNetworkInterfaces()) {
- if (netif.isUp() && netif.isMulticastCapable() && !netif.ipv4Addresses.empty()) {
+ for (const auto& netif : collectNetworkInterfaces()) {
+ if (netif->isUp() && netif->canMulticast() && hasAddressFamily<AddressFamily::V4>(*netif)) {
netifs.push_back(netif);
}
}
@@ -136,16 +137,17 @@
/** \brief determine whether a UDP multicast face is created on \p netif
*/
static bool
- isFaceOnNetif(const Face& face, const NetworkInterfaceInfo& netif)
+ isFaceOnNetif(const Face& face, const shared_ptr<const ndn::net::NetworkInterface>& netif)
{
auto ip = boost::asio::ip::address_v4::from_string(face.getLocalUri().getHost());
- return boost::count(netif.ipv4Addresses, ip) > 0;
+ return std::any_of(netif->getNetworkAddresses().begin(), netif->getNetworkAddresses().end(),
+ [ip] (const ndn::net::NetworkAddress& a) { return a.getIp() == ip; });
}
protected:
/** \brief MulticastUdpTransport-capable network interfaces
*/
- std::vector<NetworkInterfaceInfo> netifs;
+ std::vector<shared_ptr<const ndn::net::NetworkInterface>> netifs;
};
#define SKIP_IF_UDP_MCAST_NETIF_COUNT_LT(n) \
@@ -282,7 +284,7 @@
}
}
)CONFIG";
- boost::replace_first(CONFIG, "%ifname", netifs.front().name);
+ boost::replace_first(CONFIG, "%ifname", netifs.front()->getName());
parseConfig(CONFIG, false);
auto udpMcastFaces = this->listUdpMcastFaces();
@@ -310,7 +312,7 @@
}
}
)CONFIG";
- boost::replace_first(CONFIG, "%ifname", netifs.front().name);
+ boost::replace_first(CONFIG, "%ifname", netifs.front()->getName());
parseConfig(CONFIG, false);
auto udpMcastFaces = this->listUdpMcastFaces();
@@ -341,8 +343,8 @@
}
)CONFIG";
std::string CONFIG2 = CONFIG1;
- boost::replace_first(CONFIG1, "%ifname", netifs.front().name);
- boost::replace_first(CONFIG2, "%ifname", netifs.back().name);
+ boost::replace_first(CONFIG1, "%ifname", netifs.front()->getName());
+ boost::replace_first(CONFIG2, "%ifname", netifs.back()->getName());
parseConfig(CONFIG1, false);
auto udpMcastFaces = this->listUdpMcastFaces();
diff --git a/tests/daemon/face/unicast-udp-transport-fixture.hpp b/tests/daemon/face/unicast-udp-transport-fixture.hpp
index 74de35d..ef8f588 100644
--- a/tests/daemon/face/unicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/unicast-udp-transport-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,7 +30,7 @@
#include "face/face.hpp"
#include "dummy-receive-link-service.hpp"
-#include "test-ip.hpp"
+#include "test-netif-ip.hpp"
#include "tests/limited-io.hpp"
namespace nfd {
@@ -47,7 +47,7 @@
UnicastUdpTransportFixture()
: transport(nullptr)
, remoteSocket(g_io)
- , defaultAddr(getTestIp<ip::address_v4>())
+ , defaultAddr(getTestIp<AddressFamily::V4>())
, receivedPackets(nullptr)
{
}
diff --git a/tests/daemon/face/unicast-udp-transport.t.cpp b/tests/daemon/face/unicast-udp-transport.t.cpp
index c73e5e6..abb3a58 100644
--- a/tests/daemon/face/unicast-udp-transport.t.cpp
+++ b/tests/daemon/face/unicast-udp-transport.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -36,7 +36,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesLocalIpv4)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -52,7 +52,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesLocalIpv6)
{
- auto address = getTestIp<ip::address_v6>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V6>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -68,7 +68,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesNonLocalIpv4)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::No);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::No);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -86,7 +86,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesNonLocalIpv6)
{
- auto address = getTestIp<ip::address_v6>(LoopbackAddress::No);
+ auto address = getTestIp<AddressFamily::V6>(LoopbackAddress::No);
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -104,7 +104,7 @@
BOOST_AUTO_TEST_CASE(PersistencyChange)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address);
@@ -115,7 +115,7 @@
BOOST_AUTO_TEST_CASE(ExpirationTime)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address, ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
BOOST_CHECK_NE(transport->getExpirationTime(), time::steady_clock::TimePoint::max());
@@ -129,7 +129,7 @@
BOOST_AUTO_TEST_CASE(IdleClose)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address, ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
@@ -162,7 +162,7 @@
BOOST_AUTO_TEST_CASE_TEMPLATE(RemoteClose, Persistency, RemoteClosePersistencies)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address, Persistency::value);
@@ -188,7 +188,7 @@
BOOST_AUTO_TEST_CASE(RemoteClosePermanent)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
initialize(address, ndn::nfd::FACE_PERSISTENCY_PERMANENT);
diff --git a/tests/daemon/face/websocket-channel.t.cpp b/tests/daemon/face/websocket-channel.t.cpp
index 8c1f6c8..8c45af8 100644
--- a/tests/daemon/face/websocket-channel.t.cpp
+++ b/tests/daemon/face/websocket-channel.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -27,7 +27,7 @@
#include "face/websocket-transport.hpp"
#include "channel-fixture.hpp"
-#include "test-ip.hpp"
+#include "test-netif-ip.hpp"
namespace nfd {
namespace face {
@@ -182,7 +182,7 @@
BOOST_AUTO_TEST_CASE(MultipleAccepts)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->listen(address);
@@ -213,7 +213,7 @@
BOOST_AUTO_TEST_CASE(Send)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->initialize(address);
auto transport = listenerFaces.front()->getTransport();
@@ -241,7 +241,7 @@
BOOST_AUTO_TEST_CASE(Receive)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->initialize(address);
@@ -265,7 +265,7 @@
BOOST_AUTO_TEST_CASE(FaceClosure)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->initialize(address);
@@ -275,7 +275,7 @@
BOOST_AUTO_TEST_CASE(RemoteClose)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->initialize(address);
@@ -288,7 +288,7 @@
BOOST_AUTO_TEST_CASE(SetPingInterval)
{
auto pingInterval = time::milliseconds(300);
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->initialize(address, pingInterval, time::milliseconds(1000));
@@ -300,7 +300,7 @@
BOOST_AUTO_TEST_CASE(SetPongTimeOut)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
this->initialize(address, time::milliseconds(500), time::milliseconds(300));
clientShouldPong = false;
diff --git a/tests/daemon/face/websocket-transport.t.cpp b/tests/daemon/face/websocket-transport.t.cpp
index 5d537ab..c974802 100644
--- a/tests/daemon/face/websocket-transport.t.cpp
+++ b/tests/daemon/face/websocket-transport.t.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -27,7 +27,7 @@
#include "face/face.hpp"
#include "dummy-receive-link-service.hpp"
-#include "test-ip.hpp"
+#include "test-netif-ip.hpp"
#include "transport-test-common.hpp"
#include "tests/limited-io.hpp"
@@ -227,7 +227,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesLocalIpv4)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address);
ip::tcp::endpoint ep(address, 20070);
this->endToEndInitialize(ep);
@@ -244,7 +244,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesNonLocalIpv4)
{
- auto address = getTestIp<ip::address_v4>(LoopbackAddress::No);
+ auto address = getTestIp<AddressFamily::V4>(LoopbackAddress::No);
SKIP_IF_IP_UNAVAILABLE(address);
ip::tcp::endpoint ep(address, 20070);
this->endToEndInitialize(ep);
@@ -261,7 +261,7 @@
BOOST_AUTO_TEST_CASE(StaticPropertiesLocalIpv4MappedIpv6)
{
- auto address4 = getTestIp<ip::address_v4>(LoopbackAddress::Yes);
+ auto address4 = getTestIp<AddressFamily::V4>(LoopbackAddress::Yes);
SKIP_IF_IP_UNAVAILABLE(address4);
auto address6 = ip::address_v6::v4_mapped(address4);
BOOST_REQUIRE(address6.is_v4_mapped());
@@ -280,7 +280,7 @@
BOOST_AUTO_TEST_CASE(PersistencyChange)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
this->endToEndInitialize(ip::tcp::endpoint(address, 20070));
@@ -291,7 +291,7 @@
BOOST_AUTO_TEST_CASE(PingPong)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
this->endToEndInitialize(ip::tcp::endpoint(address, 20070),
time::milliseconds(500), time::milliseconds(300));
@@ -316,7 +316,7 @@
BOOST_AUTO_TEST_CASE(Send)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
this->endToEndInitialize(ip::tcp::endpoint(address, 20070));
@@ -343,7 +343,7 @@
BOOST_AUTO_TEST_CASE(ReceiveNormal)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
this->endToEndInitialize(ip::tcp::endpoint(address, 20070));
@@ -365,7 +365,7 @@
BOOST_AUTO_TEST_CASE(ReceiveMalformed)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
this->endToEndInitialize(ip::tcp::endpoint(address, 20070));
@@ -391,7 +391,7 @@
BOOST_AUTO_TEST_CASE(Close)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
this->endToEndInitialize(ip::tcp::endpoint(address, 20070));
@@ -419,7 +419,7 @@
BOOST_AUTO_TEST_CASE(RemoteClose)
{
- auto address = getTestIp<ip::address_v4>();
+ auto address = getTestIp<AddressFamily::V4>();
SKIP_IF_IP_UNAVAILABLE(address);
this->endToEndInitialize(ip::tcp::endpoint(address, 20070));