Browse files

exclude NetworkInterface where not supported

Exclude NetworkInterface and MulticastSocket on platforms where we do
not have network interface detection implemented
  • Loading branch information...
1 parent ba70e7f commit 007659a107e4dc2f26ac8af545baa7eaeff6cbee @aleks-f aleks-f committed Dec 23, 2012
View
12 Foundation/include/Poco/Platform.h
@@ -102,6 +102,12 @@
#elif defined(__QNX__)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_QNX
+#elif defined(__CYGWIN__)
+ #define POCO_OS_FAMILY_UNIX 1
+ #define POCO_OS POCO_OS_CYGWIN
+#elif defined(POCO_VXWORKS)
+ #define POCO_OS_FAMILY_UNIX 1
+ #define POCO_OS POCO_OS_VXWORKS
#elif defined(unix) || defined(__unix) || defined(__unix__)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_UNKNOWN_UNIX
@@ -111,15 +117,9 @@
#elif defined(_WIN32) || defined(_WIN64)
#define POCO_OS_FAMILY_WINDOWS 1
#define POCO_OS POCO_OS_WINDOWS_NT
-#elif defined(__CYGWIN__)
- #define POCO_OS_FAMILY_UNIX 1
- #define POCO_OS POCO_OS_CYGWIN
#elif defined(__VMS)
#define POCO_OS_FAMILY_VMS 1
#define POCO_OS POCO_OS_VMS
-#elif defined(POCO_VXWORKS)
- #define POCO_OS_FAMILY_UNIX 1
- #define POCO_OS POCO_OS_VXWORKS
#endif
View
8 Net/include/Poco/Net/MulticastSocket.h
@@ -41,6 +41,11 @@
#include "Poco/Net/Net.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "Poco/Net/DatagramSocket.h"
#include "Poco/Net/NetworkInterface.h"
@@ -135,4 +140,7 @@ class Net_API MulticastSocket: public DatagramSocket
} } // namespace Poco::Net
+#endif // POCO_NET_HAS_INTERFACE
+
+
#endif // Net_MulticastSocket_INCLUDED
View
8 Net/include/Poco/Net/Net.h
@@ -134,4 +134,12 @@ inline void Net_API uninitializeNetwork();
#endif // POCO_NET_NO_WINDOWS_INIT
+//
+// Define POCO_NET_HAS_INTERFACE for platforms that have network interface detection implemented.
+//
+#if defined(POCO_OS_FAMILY_WINDOWS) || (POCO_OS == POCO_OS_LINUX) || defined(POCO_OS_FAMILY_BSD) || (POCO_OS == POCO_OS_SOLARIS) || (POCO_OS == POCO_OS_QNX)
+ #define POCO_NET_HAS_INTERFACE
+#endif
+
+
#endif // Net_Net_INCLUDED
View
8 Net/include/Poco/Net/NetworkInterface.h
@@ -41,6 +41,11 @@
#include "Poco/Net/Net.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "Poco/Net/IPAddress.h"
#include "Poco/Mutex.h"
#include "Poco/Tuple.h"
@@ -330,4 +335,7 @@ inline bool NetworkInterface::operator == (const NetworkInterface& other) const
Net_API std::ostream& operator<<(std::ostream& os, const Poco::Net::NetworkInterface::MACAddress& mac);
+#endif // POCO_NET_HAS_INTERFACE
+
+
#endif // Net_NetworkInterface_INCLUDED
View
8 Net/src/MulticastSocket.cpp
@@ -35,6 +35,11 @@
#include "Poco/Net/MulticastSocket.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "Poco/Net/NetException.h"
#include <cstring>
@@ -263,3 +268,6 @@ void MulticastSocket::leaveGroup(const IPAddress& groupAddress, const NetworkInt
} } // namespace Poco::Net
+
+
+#endif // POCO_NET_HAS_INTERFACE
View
10 Net/src/NetworkInterface.cpp
@@ -35,6 +35,11 @@
#include "Poco/Net/NetworkInterface.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "Poco/Net/DatagramSocket.h"
#include "Poco/Net/NetException.h"
#include "Poco/NumberFormatter.h"
@@ -949,7 +954,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
pAddress = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(memory.begin()); // leave in the loop, begin may change after resize
poco_assert (memory.capacity() >= outBufLen);
if (ERROR_BUFFER_OVERFLOW == (dwRetVal = GetAdaptersAddresses(family, flags, 0, pAddress, &outBufLen)))
- memory.resize(outBufLen); // adjust size and try again
+ memory.resize(outBufLen, false); // adjust size and try again
else if (ERROR_NO_DATA == dwRetVal) // no network interfaces found
return result;
else if (NO_ERROR != dwRetVal) // error occurred
@@ -1540,3 +1545,6 @@ NetworkInterface::NetworkInterfaceList NetworkInterface::list()
#endif
+
+
+#endif // POCO_NET_HAS_INTERFACE
View
7 Net/testsuite/src/MulticastEchoServer.cpp
@@ -31,6 +31,11 @@
#include "MulticastEchoServer.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "Poco/Timespan.h"
#include <iostream>
@@ -120,3 +125,5 @@ Poco::Net::NetworkInterface MulticastEchoServer::findInterface()
}
return NetworkInterface();
}
+
+#endif // POCO_NET_HAS_INTERFACE
View
8 Net/testsuite/src/MulticastEchoServer.h
@@ -37,6 +37,11 @@
#include "Poco/Net/Net.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "Poco/Net/MulticastSocket.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/NetworkInterface.h"
@@ -82,4 +87,7 @@ class MulticastEchoServer: public Poco::Runnable
};
+#endif // POCO_NET_HAS_INTERFACE
+
+
#endif // MulticastEchoServer_INCLUDED
View
8 Net/testsuite/src/MulticastSocketTest.cpp
@@ -31,6 +31,11 @@
#include "MulticastSocketTest.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h"
#include "MulticastEchoServer.h"
@@ -94,3 +99,6 @@ CppUnit::Test* MulticastSocketTest::suite()
return pSuite;
}
+
+
+#endif // POCO_NET_HAS_INTERFACE
View
8 Net/testsuite/src/MulticastSocketTest.h
@@ -37,6 +37,11 @@
#include "Poco/Net/Net.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "CppUnit/TestCase.h"
@@ -57,4 +62,7 @@ class MulticastSocketTest: public CppUnit::TestCase
};
+#endif // POCO_NET_HAS_INTERFACE
+
+
#endif // MulticastSocketTest_INCLUDED
View
3 Net/testsuite/src/NetCoreTestSuite.cpp
@@ -44,7 +44,8 @@ CppUnit::Test* NetCoreTestSuite::suite()
pSuite->addTest(IPAddressTest::suite());
pSuite->addTest(SocketAddressTest::suite());
pSuite->addTest(DNSTest::suite());
+#ifdef POCO_NET_HAS_INTERFACE
pSuite->addTest(NetworkInterfaceTest::suite());
-
+#endif // POCO_NET_HAS_INTERFACE
return pSuite;
}
View
8 Net/testsuite/src/NetworkInterfaceTest.cpp
@@ -31,6 +31,11 @@
#include "NetworkInterfaceTest.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h"
#include "Poco/Net/NetworkInterface.h"
@@ -231,3 +236,6 @@ CppUnit::Test* NetworkInterfaceTest::suite()
return pSuite;
}
+
+
+#endif // POCO_NET_HAS_INTERFACE
View
8 Net/testsuite/src/NetworkInterfaceTest.h
@@ -37,6 +37,11 @@
#include "Poco/Net/Net.h"
+
+
+#ifdef POCO_NET_HAS_INTERFACE
+
+
#include "CppUnit/TestCase.h"
@@ -63,4 +68,7 @@ class NetworkInterfaceTest: public CppUnit::TestCase
};
+#endif // POCO_NET_HAS_INTERFACE
+
+
#endif // NetworkInterfaceTest_INCLUDED

0 comments on commit 007659a

Please sign in to comment.