diff --git a/Builds/VisualStudio2013/beast.vcxproj b/Builds/VisualStudio2013/beast.vcxproj
index ca4bc0d4..6bceab50 100644
--- a/Builds/VisualStudio2013/beast.vcxproj
+++ b/Builds/VisualStudio2013/beast.vcxproj
@@ -83,8 +83,15 @@
+
+
+
+
+
+
+
@@ -150,6 +157,7 @@
+
@@ -238,15 +246,7 @@
-
-
-
-
-
-
-
-
@@ -270,9 +270,6 @@
-
-
-
@@ -325,7 +322,6 @@
-
@@ -424,6 +420,12 @@
+
+ true
+ true
+ true
+ true
+
true
@@ -743,12 +745,6 @@
true
-
- true
- true
- true
- true
-
true
true
@@ -826,18 +822,6 @@
true
true
-
- true
- true
- true
- true
-
-
- true
- true
- true
- true
-
true
true
diff --git a/Builds/VisualStudio2013/beast.vcxproj.filters b/Builds/VisualStudio2013/beast.vcxproj.filters
index f28b074d..09b0c43b 100644
--- a/Builds/VisualStudio2013/beast.vcxproj.filters
+++ b/Builds/VisualStudio2013/beast.vcxproj.filters
@@ -159,9 +159,6 @@
{54bbe439-76c3-4781-becc-9c70a2be6d82}
-
- {af535ad5-a06c-462f-8ac0-8207a708e032}
-
{c7a576bb-27b2-486e-aa14-3c51aa86c50f}
@@ -710,36 +707,12 @@
beast_core\system
-
- beast_asio\async
-
-
- beast_asio\async
-
-
- beast_asio\async
-
-
- beast_asio\async
-
-
- beast_asio\async
-
beast_asio\basics
beast_asio\basics
-
- beast_asio\sockets
-
-
- beast_asio\sockets
-
-
- beast_asio\sockets
-
beast_asio\system
@@ -824,9 +797,6 @@
beast_asio\http
-
- beast_asio\basics
-
beast_core\memory
@@ -839,9 +809,6 @@
beast_core\diagnostic
-
- beast_core\memory
-
beast
@@ -986,12 +953,6 @@
beast\crypto
-
- beast_asio\async
-
-
- beast_asio\async
-
beast
@@ -1338,6 +1299,30 @@
beast\cxx14
+
+ beast\asio
+
+
+ beast\asio
+
+
+ beast\asio
+
+
+ beast\asio
+
+
+ beast\asio
+
+
+ beast\asio
+
+
+ beast\asio
+
+
+ beast\http\impl
+
@@ -1649,18 +1634,9 @@
beast_core\system
-
- beast_asio\async
-
beast_asio\basics
-
- beast_asio\sockets
-
-
- beast_asio\sockets
-
beast_asio\system
@@ -1931,6 +1907,9 @@
beast\cxx14\tests
+
+ beast\asio
+
diff --git a/beast/Asio.h b/beast/Asio.h
index d4e8c590..13c961f4 100644
--- a/beast/Asio.h
+++ b/beast/Asio.h
@@ -20,6 +20,4 @@
#ifndef BEAST_ASIO_H_INCLUDED
#define BEAST_ASIO_H_INCLUDED
-#include "asio/IPAddressConversion.h"
-
#endif
diff --git a/beast/asio/Asio.cpp b/beast/asio/Asio.cpp
index 5aa88c74..aada5e4b 100644
--- a/beast/asio/Asio.cpp
+++ b/beast/asio/Asio.cpp
@@ -20,3 +20,9 @@
#include "BeastConfig.h"
#include "impl/IPAddressConversion.cpp"
+
+#include "tests/wrap_handler_tests.cpp"
+#include "tests/bind_handler_tests.cpp"
+#include "tests/shared_handler_tests.cpp"
+
+#include "abstract_socket.cpp" // TEMPORARY!
diff --git a/beast/asio/abstract_socket.cpp b/beast/asio/abstract_socket.cpp
new file mode 100644
index 00000000..ba2e950e
--- /dev/null
+++ b/beast/asio/abstract_socket.cpp
@@ -0,0 +1,217 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include "abstract_socket.h"
+#include "bind_handler.h"
+
+namespace beast {
+namespace asio {
+
+#if ! BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
+
+//------------------------------------------------------------------------------
+//
+// Socket
+//
+//------------------------------------------------------------------------------
+
+void* abstract_socket::this_layer_ptr (char const*) const
+{
+ pure_virtual_called ();
+ return nullptr;
+}
+
+//------------------------------------------------------------------------------
+//
+// native_handle
+//
+//------------------------------------------------------------------------------
+
+bool abstract_socket::native_handle (char const*, void*)
+{
+ pure_virtual_called ();
+ return false;
+}
+
+//------------------------------------------------------------------------------
+//
+// basic_io_object
+//
+//------------------------------------------------------------------------------
+
+boost::asio::io_service& abstract_socket::get_io_service ()
+{
+ pure_virtual_called ();
+ return *static_cast (nullptr);
+}
+
+//------------------------------------------------------------------------------
+//
+// basic_socket
+//
+//------------------------------------------------------------------------------
+
+void*
+abstract_socket::lowest_layer_ptr (char const*) const
+{
+ pure_virtual_called ();
+ return nullptr;
+}
+
+auto
+abstract_socket::cancel (boost::system::error_code& ec) -> error_code
+{
+ return pure_virtual_error (ec);
+}
+
+auto
+abstract_socket::shutdown (shutdown_type, boost::system::error_code& ec) -> error_code
+{
+ return pure_virtual_error (ec);
+}
+
+auto
+abstract_socket::close (boost::system::error_code& ec) -> error_code
+{
+ return pure_virtual_error (ec);
+}
+
+//------------------------------------------------------------------------------
+//
+// basic_socket_acceptor
+//
+//------------------------------------------------------------------------------
+
+auto
+abstract_socket::accept (abstract_socket&, error_code& ec) -> error_code
+{
+ return pure_virtual_error (ec);
+}
+
+void
+abstract_socket::async_accept (abstract_socket&, error_handler handler)
+{
+ get_io_service ().post (bind_handler (
+ handler, pure_virtual_error()));
+}
+
+//------------------------------------------------------------------------------
+//
+// basic_stream_socket
+//
+//------------------------------------------------------------------------------
+
+std::size_t
+abstract_socket::read_some (mutable_buffers, error_code& ec)
+{
+ ec = pure_virtual_error ();
+ return 0;
+}
+
+std::size_t
+abstract_socket::write_some (const_buffers, error_code& ec)
+{
+ ec = pure_virtual_error ();
+ return 0;
+}
+
+void
+abstract_socket::async_read_some (mutable_buffers, transfer_handler handler)
+{
+ get_io_service ().post (bind_handler (
+ handler, pure_virtual_error(), 0));
+}
+
+void
+abstract_socket::async_write_some (const_buffers, transfer_handler handler)
+{
+ get_io_service ().post (bind_handler (
+ handler, pure_virtual_error(), 0));
+}
+
+//------------------------------------------------------------------------------
+//
+// ssl::stream
+//
+//------------------------------------------------------------------------------
+
+void*
+abstract_socket::next_layer_ptr (char const*) const
+{
+ pure_virtual_called ();
+ return nullptr;
+}
+
+bool
+abstract_socket::needs_handshake ()
+{
+ return false;
+}
+
+void
+abstract_socket::set_verify_mode (int)
+{
+ pure_virtual_called ();
+}
+
+auto
+abstract_socket::handshake (handshake_type, error_code& ec) -> error_code
+{
+ return pure_virtual_error (ec);
+}
+
+void
+abstract_socket::async_handshake (handshake_type, error_handler handler)
+{
+ get_io_service ().post (bind_handler (
+ handler, pure_virtual_error()));
+}
+
+auto
+abstract_socket::handshake (handshake_type, const_buffers, error_code& ec) ->
+ error_code
+{
+ return pure_virtual_error (ec);
+}
+
+void
+abstract_socket::async_handshake (handshake_type, const_buffers,
+ transfer_handler handler)
+{
+ get_io_service ().post (bind_handler (
+ handler, pure_virtual_error(), 0));
+}
+
+auto
+abstract_socket::shutdown (error_code& ec) -> error_code
+{
+ return pure_virtual_error (ec);
+}
+
+void
+abstract_socket::async_shutdown (error_handler handler)
+{
+ get_io_service ().post (bind_handler (
+ handler, pure_virtual_error()));
+}
+
+#endif
+
+}
+}
diff --git a/modules/beast_asio/sockets/Socket.h b/beast/asio/abstract_socket.h
similarity index 54%
rename from modules/beast_asio/sockets/Socket.h
rename to beast/asio/abstract_socket.h
index 963563e3..9900e184 100644
--- a/modules/beast_asio/sockets/Socket.h
+++ b/beast/asio/abstract_socket.h
@@ -17,8 +17,28 @@
*/
//==============================================================================
-#ifndef BEAST_ASIO_SOCKETS_SOCKET_H_INCLUDED
-#define BEAST_ASIO_SOCKETS_SOCKET_H_INCLUDED
+#ifndef BEAST_ASIO_ABSTRACT_SOCKET_H_INCLUDED
+#define BEAST_ASIO_ABSTRACT_SOCKET_H_INCLUDED
+
+#include "buffer_sequence.h"
+#include "shared_handler.h"
+
+#include
+#include
+
+// Checking overrides replaces unimplemented stubs with pure virtuals
+#ifndef BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
+# define BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES 1
+#endif
+
+#if BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
+# define BEAST_SOCKET_VIRTUAL = 0
+#else
+# define BEAST_SOCKET_VIRTUAL
+#endif
+
+namespace beast {
+namespace asio {
/** A high level socket abstraction.
@@ -29,18 +49,61 @@
When member functions are called and the underlying implementation does
not support the operation, a fatal error is generated.
*/
-class Socket
- : public SocketBase
- , public boost::asio::ssl::stream_base
+class abstract_socket
+ : public boost::asio::ssl::stream_base
, public boost::asio::socket_base
{
+protected:
+ typedef boost::system::error_code error_code;
+
+ typedef asio::shared_handler post_handler;
+
+ typedef asio::shared_handler error_handler;
+
+ typedef asio::shared_handler <
+ void (error_code, std::size_t)> transfer_handler;
+
+ static
+ void
+ pure_virtual_called()
+ {
+ throw std::runtime_error ("pure virtual called");
+ }
+
+ static
+ error_code
+ pure_virtual_error ()
+ {
+ pure_virtual_called();
+ return boost::system::errc::make_error_code (
+ boost::system::errc::function_not_supported);
+ }
+
+ static
+ error_code
+ pure_virtual_error (error_code& ec)
+ {
+ return ec = pure_virtual_error();
+ }
+
+ static
+ void
+ throw_if (error_code const& ec)
+ {
+ if (ec)
+ throw boost::system::system_error (ec);
+ }
+
public:
- virtual ~Socket ();
+ virtual ~abstract_socket ()
+ {
+ }
//--------------------------------------------------------------------------
//
- // Socket
+ // abstract_socket
//
+ //--------------------------------------------------------------------------
/** Retrieve the underlying object.
@@ -48,32 +111,32 @@ public:
exception is thrown if trying to acquire a reference.
*/
/** @{ */
- template
+ template
Object& this_layer ()
{
Object* object (this->this_layer_ptr