mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 03:03:23 +02:00
VS 2003: Win XP/SP3 compile/tests (Foundation, Net, XML, JSON, UTIL)
This commit is contained in:
@@ -384,12 +384,6 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\Debugger.cpp">
|
RelativePath=".\src\Debugger.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\src\DynamicAny.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\src\DynamicAnyHolder.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Environment.cpp">
|
RelativePath=".\src\Environment.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -552,6 +546,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\Exception.cpp">
|
RelativePath=".\src\Exception.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\FIFOBufferStream.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Format.cpp">
|
RelativePath=".\src\Format.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -844,6 +841,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\FIFOBuffer.h">
|
RelativePath=".\include\Poco\FIFOBuffer.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\FIFOBufferStream.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Format.h">
|
RelativePath=".\include\Poco\Format.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -4280,6 +4280,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\Latin1Encoding.cpp">
|
RelativePath=".\src\Latin1Encoding.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Latin2Encoding.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Latin9Encoding.cpp">
|
RelativePath=".\src\Latin9Encoding.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -4307,12 +4310,21 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\UTF16Encoding.cpp">
|
RelativePath=".\src\UTF16Encoding.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\UTF32Encoding.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\UTF8Encoding.cpp">
|
RelativePath=".\src\UTF8Encoding.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\UTF8String.cpp">
|
RelativePath=".\src\UTF8String.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Windows1250Encoding.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Windows1251Encoding.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\Windows1252Encoding.cpp">
|
RelativePath=".\src\Windows1252Encoding.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -4326,6 +4338,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Latin1Encoding.h">
|
RelativePath=".\include\Poco\Latin1Encoding.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\Latin2Encoding.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Latin9Encoding.h">
|
RelativePath=".\include\Poco\Latin9Encoding.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -4353,12 +4368,21 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\UTF16Encoding.h">
|
RelativePath=".\include\Poco\UTF16Encoding.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\UTF32Encoding.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\UTF8Encoding.h">
|
RelativePath=".\include\Poco\UTF8Encoding.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\UTF8String.h">
|
RelativePath=".\include\Poco\UTF8String.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\Windows1250Encoding.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Poco\Windows1251Encoding.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\Windows1252Encoding.h">
|
RelativePath=".\include\Poco\Windows1252Encoding.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -4613,6 +4637,36 @@
|
|||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Dynamic"
|
||||||
|
Filter="">
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\Var.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\VarHolder.cpp">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\poco\dynamic\Pair.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\poco\dynamic\Struct.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\poco\dynamic\Var.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\poco\dynamic\VarHolder.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\DLLVersion.rc">
|
RelativePath="..\DLLVersion.rc">
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
|
@@ -5597,6 +5597,10 @@
|
|||||||
RelativePath=".\src\UTF16Encoding.cpp"
|
RelativePath=".\src\UTF16Encoding.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\UTF32Encoding.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\UTF8Encoding.cpp"
|
RelativePath=".\src\UTF8Encoding.cpp"
|
||||||
>
|
>
|
||||||
@@ -5669,6 +5673,10 @@
|
|||||||
RelativePath=".\include\Poco\UTF16Encoding.h"
|
RelativePath=".\include\Poco\UTF16Encoding.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\poco\UTF32Encoding.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\Poco\UTF8Encoding.h"
|
RelativePath=".\include\Poco\UTF8Encoding.h"
|
||||||
>
|
>
|
||||||
|
@@ -43,9 +43,11 @@
|
|||||||
// Define to enable Windows Unicode (UTF-8) support
|
// Define to enable Windows Unicode (UTF-8) support
|
||||||
#define POCO_WIN32_UTF8
|
#define POCO_WIN32_UTF8
|
||||||
|
|
||||||
|
|
||||||
// Define to enable C++11 support
|
// Define to enable C++11 support
|
||||||
//#define POCO_ENABLE_CPP11
|
//#define POCO_ENABLE_CPP11
|
||||||
|
|
||||||
|
|
||||||
// Define to disable implicit linking
|
// Define to disable implicit linking
|
||||||
// #define POCO_NO_AUTOMATIC_LIBS
|
// #define POCO_NO_AUTOMATIC_LIBS
|
||||||
|
|
||||||
@@ -110,6 +112,10 @@
|
|||||||
// #define POCO_NO_SYSLOGCHANNEL
|
// #define POCO_NO_SYSLOGCHANNEL
|
||||||
|
|
||||||
|
|
||||||
|
// Define to enable MSVC secure warnings
|
||||||
|
// #define POCO_MSVC_SECURE_WARNINGS
|
||||||
|
|
||||||
|
|
||||||
// No support for INI file configurations in
|
// No support for INI file configurations in
|
||||||
// Poco::Util::Application.
|
// Poco::Util::Application.
|
||||||
// #define POCO_UTIL_NO_INIFILECONFIGURATION
|
// #define POCO_UTIL_NO_INIFILECONFIGURATION
|
||||||
|
@@ -41,6 +41,11 @@
|
|||||||
#define Foundation_Platform_WIN32_INCLUDED
|
#define Foundation_Platform_WIN32_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS)
|
||||||
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Verify that we're built with the multithreaded
|
// Verify that we're built with the multithreaded
|
||||||
// versions of the runtime libraries
|
// versions of the runtime libraries
|
||||||
#if defined(_MSC_VER) && !defined(_MT)
|
#if defined(_MSC_VER) && !defined(_MT)
|
||||||
@@ -54,20 +59,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Reduce bloat imported by "Poco/UnWindows.h"
|
|
||||||
#if defined(_WIN32)
|
|
||||||
// #if !defined(_WIN32_WINNT)
|
|
||||||
// #define _WIN32_WINNT 0x0501
|
|
||||||
// #endif
|
|
||||||
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(POCO_BLOATED_WIN32)
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/UnWindows.h"
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(_WIN32_WINNT)
|
#if !defined(_WIN32_WINNT)
|
||||||
#if defined(_WIN32_WINNT_WIN7)
|
#if defined(_WIN32_WINNT_WIN7)
|
||||||
//Windows 7 _WIN32_WINNT_WIN7 (0x0601)
|
//Windows 7 _WIN32_WINNT_WIN7 (0x0601)
|
||||||
@@ -88,12 +79,32 @@
|
|||||||
#elif defined (_WIN32_WINNT_WIN2K)
|
#elif defined (_WIN32_WINNT_WIN2K)
|
||||||
//Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
|
//Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
|
||||||
#define _WIN32_WINNT _WIN32_WINNT_WIN2K
|
#define _WIN32_WINNT _WIN32_WINNT_WIN2K
|
||||||
|
#elif defined (WINVER)
|
||||||
|
#define _WIN32_WINNT WINVER
|
||||||
#else
|
#else
|
||||||
#define _WIN32_WINNT 0x0500
|
#define _WIN32_WINNT 0x0500
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (_MSC_VER >= 1300) && (_MSC_VER < 1400) // Visual Studio 2003, MSVC++ 7.1
|
||||||
|
#define POCO_MSVS_VERSION 2003
|
||||||
|
#define POCO_MSVC_VERSION 71
|
||||||
|
#elif (_MSC_VER >= 1400) && (_MSC_VER < 1500) // Visual Studio 2005, MSVC++ 8.0
|
||||||
|
#define POCO_MSVS_VERSION 2005
|
||||||
|
#define POCO_MSVC_VERSION 80
|
||||||
|
#elif (_MSC_VER >= 1500) && (_MSC_VER < 1600) // Visual Studio 2008, MSVC++ 9.0
|
||||||
|
#define POCO_MSVS_VERSION 2008
|
||||||
|
#define POCO_MSVC_VERSION 90
|
||||||
|
#elif (_MSC_VER >= 1600) && (_MSC_VER < 1700) // Visual Studio 2010, MSVC++ 10.0
|
||||||
|
#define POCO_MSVS_VERSION 2010
|
||||||
|
#define POCO_MSVC_VERSION 100
|
||||||
|
#elif (_MSC_VER >= 1700) && (_MSC_VER < 1800) // Visual Studio 2011, MSVC++ 11.0
|
||||||
|
#define POCO_MSVS_VERSION 2011
|
||||||
|
#define POCO_MSVC_VERSION 110
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Unicode Support
|
// Unicode Support
|
||||||
#if defined(UNICODE) && !defined(POCO_WIN32_UTF8)
|
#if defined(UNICODE) && !defined(POCO_WIN32_UTF8)
|
||||||
#define POCO_WIN32_UTF8
|
#define POCO_WIN32_UTF8
|
||||||
@@ -103,14 +114,15 @@
|
|||||||
// Turn off some annoying warnings
|
// Turn off some annoying warnings
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(disable:4018) // signed/unsigned comparison
|
#pragma warning(disable:4018) // signed/unsigned comparison
|
||||||
#pragma warning(disable:4251) // ... needs to have dll-interface warning
|
|
||||||
#pragma warning(disable:4355) // 'this' : used in base member initializer list
|
|
||||||
#pragma warning(disable:4996) // VC++ 8.0 deprecation warnings
|
|
||||||
#pragma warning(disable:4351) // new behavior: elements of array '...' will be default initialized
|
|
||||||
#pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup
|
|
||||||
#pragma warning(disable:4275) // non dll-interface class 'std::exception' used as base for dll-interface class 'Poco::Exception'
|
|
||||||
#pragma warning(disable:4250) // VC++ 11.0: inheriting from std stream classes produces C4250 warning;
|
#pragma warning(disable:4250) // VC++ 11.0: inheriting from std stream classes produces C4250 warning;
|
||||||
// see <http://connect.microsoft.com/VisualStudio/feedback/details/733720/inheriting-from-std-fstream-produces-c4250-warning>
|
// see <http://connect.microsoft.com/VisualStudio/feedback/details/733720/inheriting-from-std-fstream-produces-c4250-warning>
|
||||||
|
#pragma warning(disable:4251) // ... needs to have dll-interface warning
|
||||||
|
#pragma warning(disable:4275) // non dll-interface class 'std::exception' used as base for dll-interface class 'Poco::Exception'
|
||||||
|
#pragma warning(disable:4344) // behavior change: use of explicit template arguments results in call to '...' but '...' is a better match
|
||||||
|
#pragma warning(disable:4351) // new behavior: elements of array '...' will be default initialized
|
||||||
|
#pragma warning(disable:4355) // 'this' : used in base member initializer list
|
||||||
|
#pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup
|
||||||
|
#pragma warning(disable:4996) // VC++ 8.0 deprecation warnings
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -54,6 +54,13 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Reduce bloat
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#if !defined(WIN32_LEAN_AND_MEAN) && !defined(POCO_BLOATED_WIN32)
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
@@ -400,6 +400,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\AnyTest.cpp">
|
RelativePath=".\src\AnyTest.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\ArrayTest.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\AutoPtrTest.cpp">
|
RelativePath=".\src\AutoPtrTest.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -416,10 +419,10 @@
|
|||||||
RelativePath=".\src\CoreTestSuite.cpp">
|
RelativePath=".\src\CoreTestSuite.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\DynamicAnyTest.cpp">
|
RelativePath=".\src\DynamicFactoryTest.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\DynamicFactoryTest.cpp">
|
RelativePath=".\src\FIFOBufferStreamTest.cpp">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\FormatTest.cpp">
|
RelativePath=".\src\FormatTest.cpp">
|
||||||
@@ -470,6 +473,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\AnyTest.h">
|
RelativePath=".\src\AnyTest.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\ArrayTest.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\AutoPtrTest.h">
|
RelativePath=".\src\AutoPtrTest.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -486,10 +492,10 @@
|
|||||||
RelativePath=".\src\CoreTestSuite.h">
|
RelativePath=".\src\CoreTestSuite.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\DynamicAnyTest.h">
|
RelativePath=".\src\DynamicFactoryTest.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\DynamicFactoryTest.h">
|
RelativePath=".\src\FIFOBufferStreamTest.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\FormatTest.h">
|
RelativePath=".\src\FormatTest.h">
|
||||||
@@ -1386,6 +1392,24 @@
|
|||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Dynamic"
|
||||||
|
Filter="">
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\VarTest.cpp">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\VarTest.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -89,6 +89,9 @@
|
|||||||
#define POCO_TRY_AGAIN WSATRY_AGAIN
|
#define POCO_TRY_AGAIN WSATRY_AGAIN
|
||||||
#define POCO_NO_RECOVERY WSANO_RECOVERY
|
#define POCO_NO_RECOVERY WSANO_RECOVERY
|
||||||
#define POCO_NO_DATA WSANO_DATA
|
#define POCO_NO_DATA WSANO_DATA
|
||||||
|
#ifndef ADDRESS_FAMILY
|
||||||
|
#define ADDRESS_FAMILY USHORT
|
||||||
|
#endif
|
||||||
#elif defined(POCO_VXWORKS)
|
#elif defined(POCO_VXWORKS)
|
||||||
#include <hostLib.h>
|
#include <hostLib.h>
|
||||||
#include <ifLib.h>
|
#include <ifLib.h>
|
||||||
|
@@ -857,13 +857,16 @@ namespace Net {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
IPAddress getBroadcastAddress(PIP_ADAPTER_PREFIX pPrefix, const IPAddress& addr)
|
IPAddress getBroadcastAddress(PIP_ADAPTER_PREFIX pPrefix, const IPAddress& addr, ULONG* pprefix = 0)
|
||||||
/// This function relies on (1) subnet prefix being at the position
|
/// This function relies on (1) subnet prefix being at the position
|
||||||
/// immediately preceding and (2) broadcast address being at the position
|
/// immediately preceding and (2) broadcast address being at the position
|
||||||
/// immediately succeeding the IPv4 unicast address.
|
/// immediately succeeding the IPv4 unicast address.
|
||||||
///
|
///
|
||||||
/// Since there is no explicit guarantee on order, to ensure correctness,
|
/// Since there is no explicit guarantee on order, to ensure correctness,
|
||||||
/// the above constraints are checked prior to returning the result.
|
/// the above constraints are checked prior to returning the result.
|
||||||
|
/// Additionally, on pre-Vista versions on Windows, the main structure does
|
||||||
|
/// not contain prefix length; for those platforms, this function
|
||||||
|
/// returns prefix through pprefix argument.
|
||||||
{
|
{
|
||||||
PIP_ADAPTER_PREFIX pPrev = 0;
|
PIP_ADAPTER_PREFIX pPrev = 0;
|
||||||
for (int i = 0; pPrefix; pPrefix = pPrefix->Next, ++i)
|
for (int i = 0; pPrefix; pPrefix = pPrefix->Next, ++i)
|
||||||
@@ -876,11 +879,14 @@ IPAddress getBroadcastAddress(PIP_ADAPTER_PREFIX pPrefix, const IPAddress& addr)
|
|||||||
|
|
||||||
if (pPrefix && pPrefix->Next && pPrev)
|
if (pPrefix && pPrefix->Next && pPrev)
|
||||||
{
|
{
|
||||||
IPAddress prefix(pPrev->PrefixLength, IPAddress::IPv4);
|
IPAddress ipPrefix(pPrev->PrefixLength, IPAddress::IPv4);
|
||||||
IPAddress mask(pPrefix->Next->Address);
|
IPAddress mask(pPrefix->Next->Address);
|
||||||
if ((prefix & mask) == (prefix & addr))
|
if ((ipPrefix & mask) == (ipPrefix & addr))
|
||||||
|
{
|
||||||
|
if (pprefix) *pprefix = pPrefix->Length;
|
||||||
return IPAddress(pPrefix->Next->Address);
|
return IPAddress(pPrefix->Next->Address);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return IPAddress(IPAddress::IPv4);
|
return IPAddress(IPAddress::IPv4);
|
||||||
}
|
}
|
||||||
@@ -931,7 +937,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
ULONG outBufLen = 16384;
|
ULONG outBufLen = 16384;
|
||||||
Poco::Buffer<UCHAR> memory(outBufLen);
|
Poco::Buffer<UCHAR> memory(outBufLen);
|
||||||
ULONG flags = (GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_INCLUDE_PREFIX);
|
ULONG flags = (GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_INCLUDE_PREFIX);
|
||||||
#if (POCO_OS != POCO_OS_WINDOWS_CE)
|
#ifdef GAA_FLAG_INCLUDE_ALL_INTERFACES
|
||||||
flags |= GAA_FLAG_INCLUDE_ALL_INTERFACES;
|
flags |= GAA_FLAG_INCLUDE_ALL_INTERFACES;
|
||||||
#endif
|
#endif
|
||||||
#if defined(POCO_HAVE_IPv6)
|
#if defined(POCO_HAVE_IPv6)
|
||||||
@@ -965,10 +971,18 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
unsigned ifIndex = 0;
|
unsigned ifIndex = 0;
|
||||||
|
|
||||||
#if defined(POCO_HAVE_IPv6)
|
#if defined(POCO_HAVE_IPv6)
|
||||||
|
#if defined (IP_ADAPTER_IPV6_ENABLED)
|
||||||
if (pAddress->Flags & IP_ADAPTER_IPV6_ENABLED) ifIndex = pAddress->Ipv6IfIndex;
|
if (pAddress->Flags & IP_ADAPTER_IPV6_ENABLED) ifIndex = pAddress->Ipv6IfIndex;
|
||||||
else
|
#else
|
||||||
|
ifIndex = pAddress->Ipv6IfIndex;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#if defined (IP_ADAPTER_IPV4_ENABLED)
|
||||||
if (pAddress->Flags & IP_ADAPTER_IPV4_ENABLED) ifIndex = pAddress->IfIndex;
|
if (pAddress->Flags & IP_ADAPTER_IPV4_ENABLED) ifIndex = pAddress->IfIndex;
|
||||||
|
#else
|
||||||
|
ifIndex = pAddress->IfIndex;
|
||||||
|
#endif
|
||||||
|
if (ifIndex == 0) continue;
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string displayName;
|
std::string displayName;
|
||||||
@@ -999,7 +1013,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
ifIt->second.impl().setFlags(pAddress->Flags, pAddress->IfType);
|
ifIt->second.impl().setFlags(pAddress->Flags, pAddress->IfType);
|
||||||
ifIt->second.impl().setMtu(pAddress->Mtu);
|
ifIt->second.impl().setMtu(pAddress->Mtu);
|
||||||
ifIt->second.impl().setUp(pAddress->OperStatus == IfOperStatusUp);
|
ifIt->second.impl().setUp(pAddress->OperStatus == IfOperStatusUp);
|
||||||
|
#if (_WIN32_WINNT >= 0x0600) // Vista and newer only
|
||||||
ifIt->second.impl().setRunning(pAddress->ReceiveLinkSpeed > 0 || pAddress->TransmitLinkSpeed > 0);
|
ifIt->second.impl().setRunning(pAddress->ReceiveLinkSpeed > 0 || pAddress->TransmitLinkSpeed > 0);
|
||||||
|
#endif
|
||||||
ifIt->second.impl().setType(fromNative(pAddress->IfType));
|
ifIt->second.impl().setType(fromNative(pAddress->IfType));
|
||||||
if (pAddress->PhysicalAddressLength)
|
if (pAddress->PhysicalAddressLength)
|
||||||
ifIt->second.impl().setMACAddress(pAddress->PhysicalAddress, pAddress->PhysicalAddressLength);
|
ifIt->second.impl().setMACAddress(pAddress->PhysicalAddress, pAddress->PhysicalAddressLength);
|
||||||
@@ -1008,7 +1024,6 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
pUniAddr;
|
pUniAddr;
|
||||||
pUniAddr = pUniAddr->Next)
|
pUniAddr = pUniAddr->Next)
|
||||||
{
|
{
|
||||||
UINT8 prefixLength = pUniAddr->OnLinkPrefixLength;
|
|
||||||
address = IPAddress(pUniAddr->Address);
|
address = IPAddress(pUniAddr->Address);
|
||||||
ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family;
|
ADDRESS_FAMILY family = pUniAddr->Address.lpSockaddr->sa_family;
|
||||||
switch (family)
|
switch (family)
|
||||||
@@ -1017,12 +1032,31 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
{
|
{
|
||||||
// Windows lists broadcast address on localhost
|
// Windows lists broadcast address on localhost
|
||||||
bool hasBroadcast = (pAddress->IfType == IF_TYPE_ETHERNET_CSMACD) || (pAddress->IfType == IF_TYPE_SOFTWARE_LOOPBACK);
|
bool hasBroadcast = (pAddress->IfType == IF_TYPE_ETHERNET_CSMACD) || (pAddress->IfType == IF_TYPE_SOFTWARE_LOOPBACK);
|
||||||
// On Windows, a valid broadcast address will be all 1's (== address | ~subnetMask); we go an extra mile here in order to
|
|
||||||
// make sure we reflect the actual value held by system and protect against misconfiguration (e.g. bad DHCP config entry)
|
|
||||||
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address);
|
|
||||||
subnetMask = prefixLength ? IPAddress(prefixLength, IPAddress::IPv4) : IPAddress();
|
|
||||||
if (hasBroadcast)
|
if (hasBroadcast)
|
||||||
|
{
|
||||||
|
// On Windows, a valid broadcast address will be all 1's (== address | ~subnetMask); additionaly, on pre-Vista versions of
|
||||||
|
// OS, master address structure does not contain member for prefix length; we go an extra mile here in order to make sure
|
||||||
|
// we reflect the actual values held by system and protect against misconfiguration (e.g. bad DHCP config entry)
|
||||||
|
#if (_WIN32_WINNT >= 0x0600) // Vista and newer
|
||||||
|
UINT8 prefixLength = pUniAddr->OnLinkPrefixLength;
|
||||||
|
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address);
|
||||||
|
#else
|
||||||
|
ULONG prefixLength = 0;
|
||||||
|
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength);
|
||||||
|
// if previous call did not do it, make last-ditch attempt for prefix and broadcast
|
||||||
|
if (prefixLength == 0 && pAddress->FirstPrefix)
|
||||||
|
prefixLength = pAddress->FirstPrefix->Length;
|
||||||
|
poco_assert (prefixLength <= 32);
|
||||||
|
if (broadcastAddress.isWildcard())
|
||||||
|
{
|
||||||
|
IPAddress mask ((unsigned) prefixLength, IPAddress::IPv4);
|
||||||
|
IPAddress host(mask & address);
|
||||||
|
broadcastAddress = host | ~mask;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
subnetMask = prefixLength ? IPAddress(prefixLength, IPAddress::IPv4) : IPAddress();
|
||||||
ifIt->second.addAddress(address, subnetMask, broadcastAddress);
|
ifIt->second.addAddress(address, subnetMask, broadcastAddress);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ifIt->second.addAddress(address);
|
ifIt->second.addAddress(address);
|
||||||
} break;
|
} break;
|
||||||
|
@@ -224,7 +224,9 @@ void SocketImpl::bind6(const SocketAddress& address, bool reuseAddress, bool ipV
|
|||||||
{
|
{
|
||||||
init(address.af());
|
init(address.af());
|
||||||
}
|
}
|
||||||
|
#ifdef IPV6_V6ONLY)
|
||||||
setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0);
|
setOption(IPPROTO_IPV6, IPV6_V6ONLY, ipV6Only ? 1 : 0);
|
||||||
|
#endif
|
||||||
if (reuseAddress)
|
if (reuseAddress)
|
||||||
{
|
{
|
||||||
setReuseAddress(true);
|
setReuseAddress(true);
|
||||||
|
Reference in New Issue
Block a user