util: NetworkMonitor: fix build on unsupported platforms
Change-Id: I08ef2c3858e0aea35ec2de739ddd86734b40358d
Refs: #3353
diff --git a/src/util/network-monitor.cpp b/src/util/network-monitor.cpp
index ccb5418..6689711 100644
--- a/src/util/network-monitor.cpp
+++ b/src/util/network-monitor.cpp
@@ -37,10 +37,22 @@
class NetworkMonitor::Impl
{
public:
- Impl(NetworkMonitor& nm, boost::asio::io_service& io)
+ Impl(NetworkMonitor&, boost::asio::io_service&)
{
BOOST_THROW_EXCEPTION(Error("Network monitoring is not supported on this platform"));
}
+
+ shared_ptr<NetworkInterface>
+ getNetworkInterface(const std::string&) const
+ {
+ return {};
+ }
+
+ std::vector<shared_ptr<NetworkInterface>>
+ listNetworkInterfaces() const
+ {
+ return {};
+ }
};
} // namespace util
diff --git a/tests/unit-tests/util/network-monitor.t.cpp b/tests/unit-tests/util/network-monitor.t.cpp
index bac8750..0e6e599 100644
--- a/tests/unit-tests/util/network-monitor.t.cpp
+++ b/tests/unit-tests/util/network-monitor.t.cpp
@@ -33,15 +33,17 @@
BOOST_AUTO_TEST_CASE(DestructWithoutRun)
{
+#if defined(NDN_CXX_HAVE_RTNETLINK) || defined(NDN_CXX_HAVE_COREFOUNDATION_COREFOUNDATION_H)
boost::asio::io_service io;
auto nm = make_unique<NetworkMonitor>(io);
nm.reset();
+#endif
BOOST_CHECK(true); // if we got this far, the test passed
}
BOOST_AUTO_TEST_CASE(DestructWhileEnumerating)
{
-#ifdef __linux__
+#ifdef NDN_CXX_HAVE_RTNETLINK
boost::asio::io_service io;
auto nm = make_unique<NetworkMonitor>(io);