summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-04-09 08:27:31 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-04-09 08:27:31 +0000
commit85ec47ce1a85648007f6ac11ccbd956b561ef64c (patch)
tree9000a3a9fd0ef9533bce2ec9ee8574bb0253ac78 /ace
parentf000b88a33eca6503cc5d6c242d3c50a0015319e (diff)
downloadATCD-85ec47ce1a85648007f6ac11ccbd956b561ef64c.tar.gz
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r--ace/Asynch_Acceptor.cpp11
-rw-r--r--ace/Asynch_IO.cpp8
-rw-r--r--ace/Asynch_IO.h6
-rw-r--r--ace/config-win32-common.h5
-rw-r--r--ace/config-win32.h1
5 files changed, 28 insertions, 3 deletions
diff --git a/ace/Asynch_Acceptor.cpp b/ace/Asynch_Acceptor.cpp
index 07939c729e4..9d5386ceb3c 100644
--- a/ace/Asynch_Acceptor.cpp
+++ b/ace/Asynch_Acceptor.cpp
@@ -4,8 +4,8 @@
#define ACE_BUILD_DLL
#include "ace/Asynch_Acceptor.h"
-#if defined (ACE_WIN32)
-// This only works on Win32 platforms
+#if defined (ACE_WIN32)
+// This only works on Win32 platforms
#include "ace/Message_Block.h"
#include "ace/INET_Addr.h"
@@ -110,6 +110,7 @@ ACE_Asynch_Acceptor<HANDLER>::accept (size_t bytes_to_read)
template <class HANDLER> void
ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &result)
{
+#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400)
// If the asynchronous accept succeeds
if (result.success ())
{
@@ -156,6 +157,7 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
// Start off another asynchronous accept to keep the backlog going
this->accept (this->bytes_to_read_);
+#endif // defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400)
}
template <class HANDLER> int
@@ -172,6 +174,7 @@ ACE_Asynch_Acceptor<HANDLER>::parse_address (ACE_Message_Block &message_block,
ACE_INET_Addr &remote_address,
ACE_INET_Addr &local_address)
{
+#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400)
sockaddr *local_addr = 0;
sockaddr *remote_addr = 0;
int local_size = 0;
@@ -188,6 +191,10 @@ ACE_Asynch_Acceptor<HANDLER>::parse_address (ACE_Message_Block &message_block,
local_address.set_addr ((sockaddr_in *) local_addr, local_size);
remote_address.set_addr ((sockaddr_in *) remote_addr, remote_size);
+#else
+ // just in case
+ errno = ENOTSUP;
+#endif // defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400)
}
template <class HANDLER> ACE_HANDLE
diff --git a/ace/Asynch_IO.cpp b/ace/Asynch_IO.cpp
index e6c8289dac4..067810f139e 100644
--- a/ace/Asynch_IO.cpp
+++ b/ace/Asynch_IO.cpp
@@ -487,6 +487,7 @@ ACE_Asynch_Accept::accept (ACE_Message_Block &message_block,
ACE_HANDLE accept_handle,
const void *act)
{
+#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400)
// Sanity check: make sure that enough space has been allocated by the caller.
size_t address_size = sizeof (sockaddr_in) + sizeof (sockaddr);
size_t space_in_use = message_block.wr_ptr () - message_block.base ();
@@ -557,6 +558,9 @@ ACE_Asynch_Accept::accept (ACE_Message_Block &message_block,
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ReadFile"), -1);
}
+#else
+ ACE_NOTSUP_RETURN (-1);
+#endif /* defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400) */
}
// ************************************************************
@@ -634,6 +638,7 @@ ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
u_long flags,
const void *act)
{
+#if defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400)
Result *result = 0;
ACE_NEW_RETURN (result,
Result (*this->handler_,
@@ -682,6 +687,9 @@ ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file,
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "TransmitFile"), -1);
}
+#else
+ ACE_NOTSUP_RETURN (-1);
+#endif /* defined (ACE_HAS_WINSOCK2) || (_WIN32_WINNT >= 0x0400) */
}
// ************************************************************
diff --git a/ace/Asynch_IO.h b/ace/Asynch_IO.h
index 69c735e253d..b0fcd522070 100644
--- a/ace/Asynch_IO.h
+++ b/ace/Asynch_IO.h
@@ -21,7 +21,11 @@
#include "ace/OS.h"
#if defined (ACE_WIN32)
-// This only works on Win32 platforms
+// This only works on Win32 platforms.
+//
+// The implementation of ACE_Asynch_Transmit_File and
+// ACE_Asynch_Accept are only supported if ACE_HAS_WINSOCK2 is defined
+// or you are on WinNT 4.0 or higher
// Forward declarations
class ACE_Proactor;
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index 4eb7c47f295..921cd42217c 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -240,6 +240,11 @@
#endif /* WIN32_LEAN_AND_MEAN */
#endif /* !defined (_INC_INWDOWS) */
+// Always use WS2 when available
+#if (_WIN32_WINNT >= 0x0400)
+ #define ACE_HAS_WINSOCK2
+#endif
+
#if defined (ACE_HAS_WINSOCK2)
#if !defined (_WINSOCK2API_)
diff --git a/ace/config-win32.h b/ace/config-win32.h
index 531e74ce34f..62f448a54f1 100644
--- a/ace/config-win32.h
+++ b/ace/config-win32.h
@@ -14,6 +14,7 @@
// Define this if you're running NT 4.x
// Setting applies to : building ACE
// Runtime restrictions: System must be Windows NT > 4.0
+// Additonal notes: Defining _WIN32_WINNT as 0x0400 implies ACE_HAS_WINSOCK2.
// #define _WIN32_WINNT 0x0400
// Uncomment this, if you want ACE to use CWinThread. This should