summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-02-07 16:49:30 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-02-07 16:49:30 +0100
commitc8f810cae2c49c45bb771974321cc702401d3464 (patch)
tree39eecd100ff09f3b56fe87e7f7ee1617fd56292d /cpp
parentAdded expect script for casino demo (diff)
downloadice-c8f810cae2c49c45bb771974321cc702401d3464.tar.bz2
ice-c8f810cae2c49c45bb771974321cc702401d3464.tar.xz
ice-c8f810cae2c49c45bb771974321cc702401d3464.zip
Fixed bug 2662
Diffstat (limited to 'cpp')
-rwxr-xr-xcpp/config/Make.rules.msvc2
-rw-r--r--cpp/demo/Ice/MFC/client/stdafx.h104
-rw-r--r--cpp/demo/Ice/MFC/server/stdafx.h104
-rw-r--r--cpp/include/IceUtil/Config.h17
-rw-r--r--cpp/include/IceUtil/Mutex.h94
-rw-r--r--cpp/src/Ice/Network.cpp88
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp40
7 files changed, 188 insertions, 261 deletions
diff --git a/cpp/config/Make.rules.msvc b/cpp/config/Make.rules.msvc
index 4a497880b90..31576db14f4 100755
--- a/cpp/config/Make.rules.msvc
+++ b/cpp/config/Make.rules.msvc
@@ -33,7 +33,7 @@ LDFLAGS = /LIBPATH:"$(THIRDPARTY_HOME)\lib"
!endif
!if "$(CPP_COMPILER)" == "VC60"
-CPPFLAGS = -I"$(THIRDPARTY_HOME)\include\stlport" -D_STLP_NEW_PLATFORM_SDK $(CPPFLAGS)
+CPPFLAGS = -I"$(THIRDPARTY_HOME)\include\stlport" $(CPPFLAGS)
!endif
!endif
diff --git a/cpp/demo/Ice/MFC/client/stdafx.h b/cpp/demo/Ice/MFC/client/stdafx.h
index 5d207793d98..09a7123ec78 100644
--- a/cpp/demo/Ice/MFC/client/stdafx.h
+++ b/cpp/demo/Ice/MFC/client/stdafx.h
@@ -7,55 +7,55 @@
//
// **********************************************************************
-
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently,
-// but are changed infrequently
-
-#pragma once
-
-//
-// For VC6 and STLport
-//
-#if !defined(NDEBUG) && !defined(_STLP_DEBUG)
-# define _STLP_DEBUG
-#endif
-
-#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-#endif
-
-// Modify the following defines if you have to target a platform prior to the ones specified below.
-// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
-#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
-#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#if 0
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
-#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
-#endif
-
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
-#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
-#endif
-#endif
-
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
-
-// turns off MFC's hiding of some common and often safely ignored warning messages
-#define _AFX_ALL_WARNINGS
-
-#include <afxwin.h> // MFC core and standard components
-#include <afxext.h> // MFC extensions
-
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
-#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
-#endif // _AFX_NO_AFXCMN_SUPPORT
-
-#include <Ice/Ice.h>
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+//
+// For VC6 and STLport
+//
+#if !defined(NDEBUG) && !defined(_STLP_DEBUG)
+# define _STLP_DEBUG
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#if 0
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <Ice/Ice.h>
diff --git a/cpp/demo/Ice/MFC/server/stdafx.h b/cpp/demo/Ice/MFC/server/stdafx.h
index 5d207793d98..09a7123ec78 100644
--- a/cpp/demo/Ice/MFC/server/stdafx.h
+++ b/cpp/demo/Ice/MFC/server/stdafx.h
@@ -7,55 +7,55 @@
//
// **********************************************************************
-
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently,
-// but are changed infrequently
-
-#pragma once
-
-//
-// For VC6 and STLport
-//
-#if !defined(NDEBUG) && !defined(_STLP_DEBUG)
-# define _STLP_DEBUG
-#endif
-
-#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-#endif
-
-// Modify the following defines if you have to target a platform prior to the ones specified below.
-// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
-#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
-#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#if 0
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
-#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
-#endif
-
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
-#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
-#endif
-#endif
-
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
-
-// turns off MFC's hiding of some common and often safely ignored warning messages
-#define _AFX_ALL_WARNINGS
-
-#include <afxwin.h> // MFC core and standard components
-#include <afxext.h> // MFC extensions
-
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
-#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
-#endif // _AFX_NO_AFXCMN_SUPPORT
-
-#include <Ice/Ice.h>
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+//
+// For VC6 and STLport
+//
+#if !defined(NDEBUG) && !defined(_STLP_DEBUG)
+# define _STLP_DEBUG
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#if 0
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <Ice/Ice.h>
diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h
index 62a06dd5b0d..5b325886718 100644
--- a/cpp/include/IceUtil/Config.h
+++ b/cpp/include/IceUtil/Config.h
@@ -97,15 +97,13 @@
#if defined(_WIN32)
-//
-// Comment out the following block if you want to run on Windows 9x
-// or Windows NT 3.51.
-//
# ifndef _WIN32_WINNT
//
- // Necessary for TryEnterCriticalSection.
+ // Necessary for TryEnterCriticalSection and some IPv6 macros used in Network.cpp
//
-# define _WIN32_WINNT 0x0400
+# define _WIN32_WINNT 0x0500
+# elif _WIN32_WINNT < 0x0500
+# error "Ice requires headers for Windows 2000 or later."
# endif
# if !defined(ICE_STATIC_LIBS) && defined(_MSC_VER) && (!defined(_DLL) || !defined(_MT))
@@ -130,6 +128,13 @@
// ...: decorated name length exceeded, name was truncated
# pragma warning( disable : 4503 )
# endif
+
+ //
+ // For STLport. Define _STLP_NEW_PLATFORM_SDK if a PSDK newer than the PSDK included with VC6.
+ //
+# if !defined(_STLP_NEW_PLATFORM_SDK) && WINVER > 0x0400
+# define _STLP_NEW_PLATFORM_SDK 1
+# endif
#endif
//
diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h
index 0ed13b36672..1d7f3fb018b 100644
--- a/cpp/include/IceUtil/Mutex.h
+++ b/cpp/include/IceUtil/Mutex.h
@@ -97,12 +97,7 @@ private:
friend class Cond;
#ifdef _WIN32
-# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400
mutable CRITICAL_SECTION _mutex;
-# else
- mutable HANDLE _mutex;
- mutable int _recursionCount;
-# endif
#else
mutable pthread_mutex_t _mutex;
#endif
@@ -114,8 +109,6 @@ private:
#ifdef _WIN32
-# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400
-
inline
Mutex::Mutex()
{
@@ -169,93 +162,6 @@ Mutex::lock(LockState&) const
EnterCriticalSection(&_mutex);
}
-# else
-
-inline
-Mutex::Mutex() :
- _recursionCount(0)
-{
- _mutex = CreateMutex(0, false, 0);
- if(_mutex == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
-}
-
-inline
-Mutex::~Mutex()
-{
- BOOL rc = CloseHandle(_mutex);
- if(rc == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
-}
-
-inline void
-Mutex::lock() const
-{
- DWORD rc = WaitForSingleObject(_mutex, INFINITE);
- if(rc != WAIT_OBJECT_0)
- {
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
- }
- _recursionCount++;
-}
-
-inline bool
-Mutex::tryLock() const
-{
- DWORD rc = WaitForSingleObject(_mutex, 0);
- if(rc != WAIT_OBJECT_0)
- {
- return false;
- }
- else if(_recursionCount == 1)
- {
- _recursionCount++;
- unlock();
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- else
- {
- _recursionCount++;
- return true;
- }
-}
-
-inline void
-Mutex::unlock() const
-{
- _recursionCount--;
- BOOL rc = ReleaseMutex(_mutex);
- if(rc == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
-}
-
-inline void
-Mutex::unlock(LockState& state) const
-{
- unlock();
-}
-
-inline void
-Mutex::lock(LockState&) const
-{
- lock();
-}
-
-# endif
-
#else
inline
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index 749b5683e27..ce9bbec5a08 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -11,10 +11,18 @@
// The following is required on HP-UX in order to bring in
// the definition for the ip_mreq structure.
//
-#ifdef __hpux
-#undef _XOPEN_SOURCE_EXTENDED
-#define _XOPEN_SOURCE
-#include <netinet/in.h>
+#if defined(__hpux)
+# undef _XOPEN_SOURCE_EXTENDED
+# define _XOPEN_SOURCE
+# include <netinet/in.h>
+#endif
+
+//
+// The following is required for the Vista PSDK to bring in
+// the definitions of the IN6_IS_ADDR_* macros.
+//
+#if defined(_WIN32) && !defined(NTDDI_VERSION)
+# define NTDDI_VERSION NTDDI_WIN2KSP1
#endif
#include <IceUtil/StringUtil.h>
@@ -68,7 +76,7 @@ getLocalAddresses(ProtocolSupport protocol)
vector<unsigned char> buffer;
buffer.resize(1024);
unsigned long len = 0;
- DWORD rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0,
+ DWORD rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0,
&buffer[0], static_cast<DWORD>(buffer.size()),
&len, 0, 0);
if(rs == SOCKET_ERROR)
@@ -80,7 +88,7 @@ getLocalAddresses(ProtocolSupport protocol)
if(getSocketErrno() == WSAEFAULT)
{
buffer.resize(len);
- rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0,
+ rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0,
&buffer[0], static_cast<DWORD>(buffer.size()),
&len, 0, 0);
}
@@ -94,7 +102,7 @@ getLocalAddresses(ProtocolSupport protocol)
}
}
- //
+ //
// Add the local interface addresses.
//
SOCKET_ADDRESS_LIST* addrs = reinterpret_cast<SOCKET_ADDRESS_LIST*>(&buffer[0]);
@@ -161,7 +169,7 @@ getLocalAddresses(ProtocolSupport protocol)
}
}
}
-
+
curr = curr->ifa_next;
}
@@ -195,7 +203,7 @@ getLocalAddresses(ProtocolSupport protocol)
int bufsize = numaddrs * static_cast<int>(sizeof(struct ifreq));
ifc.ifc_len = bufsize;
ifc.ifc_buf = (char*)malloc(bufsize);
-
+
int rs = ioctl(fd, cmd, &ifc);
if(rs == SOCKET_ERROR)
{
@@ -216,7 +224,7 @@ getLocalAddresses(ProtocolSupport protocol)
{
old_ifc_len = ifc.ifc_len;
}
-
+
numaddrs += 10;
free(ifc.ifc_buf);
}
@@ -262,11 +270,11 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot
// We now use getaddrinfo() on Windows.
//
// #ifdef _WIN32
-
+
// //
// // Windows XP has getaddrinfo(), but we don't want to require XP to run Ice.
// //
-
+
// //
// // gethostbyname() is thread safe on Windows, with a separate hostent per thread
// //
@@ -277,7 +285,7 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot
// entry = gethostbyname(host.c_str());
// }
// while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
-
+
// if(entry == 0)
// {
// DNSException ex(__FILE__, __LINE__);
@@ -293,7 +301,7 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot
memset(&addr, 0, sizeof(struct sockaddr_storage));
struct addrinfo* info = 0;
int retry = 5;
-
+
struct addrinfo hints = { 0 };
if(server)
@@ -301,7 +309,7 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot
//
// If host is empty, getaddrinfo will return the wildcard
// address instead of the loopack address.
- //
+ //
hints.ai_flags |= AI_PASSIVE;
}
@@ -327,11 +335,11 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot
}
else
{
- rs = getaddrinfo(host.c_str(), 0, &hints, &info);
+ rs = getaddrinfo(host.c_str(), 0, &hints, &info);
}
}
while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
-
+
if(rs != 0)
{
DNSException ex(__FILE__, __LINE__);
@@ -609,7 +617,7 @@ IceInternal::closeSocketNoThrow(SOCKET fd)
errno = error;
#endif
}
-
+
void
IceInternal::shutdownSocketWrite(SOCKET fd)
{
@@ -645,7 +653,7 @@ IceInternal::shutdownSocketWrite(SOCKET fd)
throw ex;
}
}
-
+
void
IceInternal::shutdownSocketReadWrite(SOCKET fd)
{
@@ -682,7 +690,7 @@ IceInternal::shutdownSocketReadWrite(SOCKET fd)
throw ex;
}
}
-
+
void
IceInternal::setBlock(SOCKET fd, bool block)
{
@@ -746,7 +754,7 @@ IceInternal::setTcpNoDelay(SOCKET fd)
throw ex;
}
}
-
+
void
IceInternal::setKeepAlive(SOCKET fd)
{
@@ -958,7 +966,7 @@ repeatListen:
{
goto repeatListen;
}
-
+
closeSocketNoThrow(fd);
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
@@ -991,7 +999,7 @@ repeatConnect:
{
goto repeatConnect;
}
-
+
if(connectInProgress())
{
if(timeout == 0)
@@ -1010,7 +1018,7 @@ repeatConnect:
}
return true;
}
-
+
closeSocketNoThrow(fd);
if(connectionRefused())
{
@@ -1097,7 +1105,7 @@ IceInternal::doFinishConnect(SOCKET fd, int timeout)
{
goto repeatSelect;
}
-
+
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
@@ -1121,7 +1129,7 @@ IceInternal::doFinishConnect(SOCKET fd, int timeout)
ex.error = getSocketErrno();
throw ex;
}
-
+
if(val > 0)
{
#ifdef _WIN32
@@ -1209,27 +1217,27 @@ repeatAccept:
pollFd[0].events = POLLIN;
rs = ::poll(pollFd, 1, timeout);
#endif
-
+
if(rs == SOCKET_ERROR)
{
if(interrupted())
{
goto repeatSelect;
}
-
+
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
-
+
if(rs == 0)
{
throw TimeoutException(__FILE__, __LINE__);
}
-
+
goto repeatAccept;
}
-
+
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
@@ -1262,7 +1270,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
// //
// // Windows XP has getaddrinfo(), but we don't want to require XP to run Ice.
// //
-
+
// //
// // gethostbyname() is thread safe on Windows, with a separate hostent per thread
// //
@@ -1274,7 +1282,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
// entry = gethostbyname(host.c_str());
// }
// while(entry == 0 && h_errno == TRY_AGAIN && --retry >= 0);
-
+
// if(entry == 0)
// {
// DNSException ex(__FILE__, __LINE__);
@@ -1289,7 +1297,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
// memcpy(&addr.sin_addr, *p, entry->h_length);
// result.push_back(addr);
// p++;
-// }
+// }
// #else
@@ -1318,7 +1326,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
{
hints.ai_flags = AI_NUMERICHOST;
}
-
+
int rs = 0;
do
{
@@ -1435,7 +1443,7 @@ IceInternal::compareAddress(const struct sockaddr_storage& addr1, const struct s
{
return 1;
}
-
+
int res = memcmp(&addr1in->sin6_addr, &addr2in->sin6_addr, sizeof(struct in6_addr));
if(res < 0)
{
@@ -1457,7 +1465,7 @@ IceInternal::createPipe(SOCKET fds[2])
SOCKET fd = createSocket(false, AF_INET);
setBlock(fd, true);
-
+
struct sockaddr_storage addr;
memset(&addr, 0, sizeof(addr));
@@ -1465,7 +1473,7 @@ IceInternal::createPipe(SOCKET fds[2])
addrin->sin_family = AF_INET;
addrin->sin_port = htons(0);
addrin->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
+
doBind(fd, addr);
doListen(fd, 1);
@@ -1694,10 +1702,10 @@ IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport proto
for(vector<struct sockaddr_storage>::const_iterator p = addrs.begin(); p != addrs.end(); ++p)
{
//
- // NOTE: We don't publish link-local IPv6 addresses as these addresses can only
+ // NOTE: We don't publish link-local IPv6 addresses as these addresses can only
// be accessed in general with a scope-id.
//
- if(p->ss_family != AF_INET6 ||
+ if(p->ss_family != AF_INET6 ||
!IN6_IS_ADDR_LINKLOCAL(&reinterpret_cast<const struct sockaddr_in6*>(&(*p))->sin6_addr))
{
hosts.push_back(inetAddrToString(*p));
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 4d2b904c185..05ff09dec7c 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -7,6 +7,14 @@
//
// **********************************************************************
+//
+// The following is required for the Vista PSDK to bring in
+// the definitions of the IN6_IS_ADDR_* macros.
+//
+#if defined(_WIN32) && !defined(NTDDI_VERSION)
+# define NTDDI_VERSION NTDDI_WIN2KSP1
+#endif
+
#include <Ice/UdpTransceiver.h>
#include <Ice/Instance.h>
#include <Ice/TraceLevels.h>
@@ -131,7 +139,7 @@ repeat:
ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]), static_cast<int>(buf.b.size()), 0);
#else
ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]), buf.b.size(), 0);
-#endif
+#endif
if(ret == SOCKET_ERROR)
{
@@ -153,7 +161,7 @@ repeat:
assert(_fd != INVALID_SOCKET);
#ifdef _WIN32
FD_SET(_fd, &_wFdSet);
-
+
if(timeout >= 0)
{
struct timeval tv;
@@ -170,14 +178,14 @@ repeat:
pollFd[0].fd = _fd;
pollFd[0].events = POLLOUT;
rs = ::poll(pollFd, 1, timeout);
-#endif
+#endif
if(rs == SOCKET_ERROR)
{
if(interrupted())
{
goto repeatSelect;
}
-
+
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
@@ -187,10 +195,10 @@ repeat:
{
throw new Ice::TimeoutException(__FILE__, __LINE__);
}
-
+
goto repeat;
}
-
+
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
@@ -201,7 +209,7 @@ repeat:
Trace out(_logger, _traceLevels->networkCat);
out << "sent " << ret << " bytes via udp\n" << toString();
}
-
+
if(_stats)
{
_stats->bytesSent(type(), static_cast<Int>(ret));
@@ -289,7 +297,7 @@ repeat:
{
goto repeat;
}
-
+
if(wouldBlock())
{
if(timeout == 0)
@@ -298,7 +306,7 @@ repeat:
}
repeatSelect:
-
+
assert(_fd != INVALID_SOCKET);
#ifdef _WIN32
FD_SET(_fd, &_rFdSet);
@@ -316,12 +324,12 @@ repeat:
{
goto repeatSelect;
}
-
+
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}
-
+
if(rs == 0)
{
throw TimeoutException(__FILE__, __LINE__);
@@ -346,7 +354,7 @@ repeat:
ex.error = getSocketErrno();
throw ex;
}
-
+
if(_traceLevels->network >= 3)
{
Trace out(_logger, _traceLevels->networkCat);
@@ -454,7 +462,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
setMcastTtl(_fd, mcastTtl, _addr.ss_family == AF_INET);
}
}
-
+
if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
@@ -473,7 +481,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
#endif
}
-IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const string& host, int port,
+IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const string& host, int port,
const string& mcastInterface, bool connect) :
_traceLevels(instance->traceLevels()),
_logger(instance->initializationData().logger),
@@ -545,7 +553,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
#endif
doBind(_fd, _addr);
}
-
+
if(_traceLevels->network >= 1)
{
Trace out(_logger, _traceLevels->networkCat);
@@ -567,7 +575,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
IceInternal::UdpTransceiver::~UdpTransceiver()
{
assert(_fd == INVALID_SOCKET);
-}
+}
//
// Set UDP receive and send buffer sizes.