mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 10:35:50 +00:00
Revise all Socket function signatures and return values
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketInterface.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketWrapper.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketWrapperBase.h" />
|
||||
<ClInclude Include="..\..\modules\beast_asio\system\beast_BoostIncludes.h" />
|
||||
<ClInclude Include="..\..\modules\beast_basics\beast_basics.h" />
|
||||
<ClInclude Include="..\..\modules\beast_basics\events\beast_DeadlineTimer.h" />
|
||||
<ClInclude Include="..\..\modules\beast_basics\events\beast_OncePerSecond.h" />
|
||||
|
||||
@@ -146,6 +146,9 @@
|
||||
<Filter Include="beast_asio\sockets">
|
||||
<UniqueIdentifier>{af535ad5-a06c-462f-8ac0-8207a708e032}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="beast_asio\system">
|
||||
<UniqueIdentifier>{c7a576bb-27b2-486e-aa14-3c51aa86c50f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
||||
@@ -764,6 +767,9 @@
|
||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketInterface.h">
|
||||
<Filter>beast_asio\sockets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\beast_asio\system\beast_BoostIncludes.h">
|
||||
<Filter>beast_asio\system</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\modules\beast_core\beast_core.cpp">
|
||||
|
||||
@@ -40,42 +40,8 @@
|
||||
// Must come before boost includes to fix the bost placeholders.
|
||||
#include "../beast_core/beast_core.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/* This module requires boost and possibly OpenSSL */
|
||||
|
||||
// Make sure we take care of fixing boost::bind oddities first.
|
||||
#if !defined(BEAST_CORE_H_INCLUDED)
|
||||
#error beast_core.h must be included before including this file
|
||||
#endif
|
||||
|
||||
#if BEAST_WIN32
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0600
|
||||
# endif
|
||||
# ifndef _VARIADIC_MAX
|
||||
# define _VARIADIC_MAX 10
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
//#include <boost/mpl/at.hpp>
|
||||
//#include <boost/asio/io_service.hpp>
|
||||
//#include <boost/array.hpp>
|
||||
//#include <boost/bind.hpp>
|
||||
//#include <boost/unordered_map.hpp>
|
||||
//#include <boost/mpl/vector.hpp>
|
||||
|
||||
// VFALCO TODO check for version availability
|
||||
#ifndef BOOST_ASIO_INITFN_RESULT_TYPE
|
||||
#define BOOST_ASIO_INITFN_RESULT_TYPE(expr,val) void
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#include "system/beast_BoostIncludes.h"
|
||||
|
||||
namespace beast
|
||||
{
|
||||
|
||||
@@ -54,6 +54,19 @@ public:
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
typedef Socket next_layer_type;
|
||||
typedef Socket lowest_layer_type;
|
||||
|
||||
virtual next_layer_type& next_layer () = 0;
|
||||
|
||||
virtual next_layer_type const& next_layer () const = 0;
|
||||
|
||||
virtual lowest_layer_type& lowest_layer () = 0;
|
||||
|
||||
virtual lowest_layer_type const& lowest_layer () const = 0;
|
||||
#endif
|
||||
|
||||
/** Determines if the underlying stream requires a handshake.
|
||||
|
||||
If is_handshaked is true, it will be necessary to call handshake or
|
||||
@@ -85,20 +98,21 @@ public:
|
||||
|
||||
@endcode
|
||||
*/
|
||||
|
||||
template <class Object>
|
||||
Object* native_object ()
|
||||
Object& native_object ()
|
||||
{
|
||||
void* const object = native_object_raw ();
|
||||
if (object != nullptr)
|
||||
return dynamic_cast <Object> (object);
|
||||
return object;
|
||||
if (object == nullptr)
|
||||
throw std::bad_cast ("null pointer");
|
||||
return *static_cast <Object*> (object);
|
||||
}
|
||||
|
||||
virtual void* native_object_raw () = 0;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// SocketInterface
|
||||
// SocketInterface::Socket
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -116,7 +130,8 @@ public:
|
||||
throw_error (shutdown (what, ec));
|
||||
}
|
||||
|
||||
virtual boost::system::error_code shutdown (shutdown_type what, boost::system::error_code& ec) = 0;
|
||||
virtual boost::system::error_code shutdown (shutdown_type what,
|
||||
boost::system::error_code& ec) = 0;
|
||||
|
||||
void close ()
|
||||
{
|
||||
@@ -128,7 +143,7 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// StreamInterface
|
||||
// SocketInterface::Stream
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -137,12 +152,14 @@ public:
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/SyncReadStream.html
|
||||
//
|
||||
template <class MutableBufferSequence>
|
||||
std::size_t read_some (MutableBufferSequence const& buffers, boost::system::error_code& ec)
|
||||
std::size_t read_some (MutableBufferSequence const& buffers,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
return read_some_impl (MutableBuffers (buffers), ec);
|
||||
return read_some (MutableBuffers (buffers), ec);
|
||||
}
|
||||
|
||||
virtual std::size_t read_some_impl (MutableBuffers const& buffers, boost::system::error_code& ec) = 0;
|
||||
virtual std::size_t read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers,
|
||||
boost::system::error_code& ec) = 0;
|
||||
|
||||
// SyncWriteStream
|
||||
//
|
||||
@@ -151,40 +168,44 @@ public:
|
||||
template <class ConstBufferSequence>
|
||||
std::size_t write_some (ConstBufferSequence const& buffers, boost::system::error_code &ec)
|
||||
{
|
||||
return write_some_impl (ConstBuffers (buffers), ec);
|
||||
return write_some (ConstBuffers (buffers), ec);
|
||||
}
|
||||
|
||||
virtual std::size_t write_some_impl (ConstBuffers const& buffers, boost::system::error_code& ec) = 0;
|
||||
virtual std::size_t write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec) = 0;
|
||||
|
||||
// AsyncReadStream
|
||||
//
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/AsyncReadStream.html
|
||||
//
|
||||
template <class MutableBufferSequence, class ReadHandler>
|
||||
void async_read_some (MutableBufferSequence const& buffers,
|
||||
BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))
|
||||
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
||||
{
|
||||
async_read_some_impl (MutableBuffers (buffers), handler);
|
||||
return async_read_some (MutableBuffers (buffers), TransferCall(handler));
|
||||
}
|
||||
|
||||
virtual void async_read_some_impl (MutableBuffers const& buffers, TransferCall const& call) = 0;
|
||||
virtual
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
||||
async_read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call) = 0;
|
||||
|
||||
// AsyncWriteStream
|
||||
//
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/AsyncWriteStream.html
|
||||
//
|
||||
template <class ConstBufferSequence, class WriteHandler>
|
||||
void async_write_some (ConstBufferSequence const& buffers,
|
||||
BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (boost::system::error_code, std::size_t))
|
||||
async_write_some (ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
||||
{
|
||||
async_write_some_impl (ConstBuffers (buffers), handler);
|
||||
return async_write_some (ConstBuffers (buffers), TransferCall(handler));
|
||||
}
|
||||
|
||||
virtual void async_write_some_impl (ConstBuffers const& buffers, TransferCall const& call) = 0;
|
||||
virtual
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
||||
async_write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call) = 0;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// HandshakeInterface
|
||||
// SocketInterface::Handshake
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -200,9 +221,24 @@ public:
|
||||
// ssl::stream::handshake (2 of 4)
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload2.html
|
||||
//
|
||||
virtual boost::system::error_code handshake (handshake_type role, boost::system::error_code& ec) = 0;
|
||||
virtual boost::system::error_code handshake (handshake_type role,
|
||||
boost::system::error_code& ec) = 0;
|
||||
|
||||
#if (BOOST_VERSION / 100) >= 1054
|
||||
// ssl::stream::async_handshake (1 of 2)
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/async_handshake/overload1.html
|
||||
//
|
||||
template <typename HandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (boost::system::error_code))
|
||||
async_handshake (handshake_type role, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
|
||||
{
|
||||
return async_handshake (role, ErrorCall (handler));
|
||||
}
|
||||
|
||||
virtual
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
|
||||
async_handshake (handshake_type role, BOOST_ASIO_MOVE_ARG(ErrorCall) call) = 0;
|
||||
|
||||
#if BOOST_ASIO_HAS_BUFFEREDHANDSHAKE
|
||||
// ssl::stream::handshake (3 of 4)
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload3.html
|
||||
//
|
||||
@@ -220,37 +256,26 @@ public:
|
||||
boost::system::error_code handshake (handshake_type role,
|
||||
ConstBufferSequence const& buffers, boost::system::error_code& ec)
|
||||
{
|
||||
return handshake_impl (role, ConstBuffers (buffers), ec);
|
||||
return handshake (role, ConstBuffers (buffers), ec);
|
||||
}
|
||||
|
||||
virtual boost::system::error_code handshake_impl (handshake_type role,
|
||||
ConstBuffers const& buffers, boost::system::error_code& ec) = 0;
|
||||
#endif
|
||||
virtual boost::system::error_code handshake (handshake_type role,
|
||||
BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec) = 0;
|
||||
|
||||
// ssl::stream::async_handshake (1 of 2)
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/async_handshake/overload1.html
|
||||
//
|
||||
template <class HandshakeHandler>
|
||||
void async_handshake (handshake_type role, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
|
||||
{
|
||||
async_handshake_impl (role, handler);
|
||||
}
|
||||
|
||||
virtual void async_handshake_impl (handshake_type role, ErrorCall const& calll) = 0;
|
||||
|
||||
#if (BOOST_VERSION / 100) >= 1054
|
||||
// ssl::stream::async_handshake (2 of 2)
|
||||
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/async_handshake/overload2.html
|
||||
//
|
||||
template <class ConstBufferSequence, class BufferedHandshakeHandler>
|
||||
void async_handshake (handshake_type role, ConstBufferSequence const& buffers,
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void (boost::system::error_code, std::size_t))
|
||||
async_handshake (handshake_type role, ConstBufferSequence const& buffers,
|
||||
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler)
|
||||
{
|
||||
async_handshake_impl (role, ConstBuffers (buffers), handler);
|
||||
return async_handshake (role, ConstBuffers (buffers), TransferCall (handler));
|
||||
}
|
||||
|
||||
virtual void async_handshake_impl (handshake_type role,
|
||||
ConstBuffers const& buffers, TransferCall const& call) = 0;
|
||||
virtual
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
||||
async_handshake (handshake_type role, BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call) = 0;
|
||||
#endif
|
||||
|
||||
// ssl::stream::shutdown
|
||||
@@ -270,10 +295,12 @@ public:
|
||||
template <class ShutdownHandler>
|
||||
void async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
|
||||
{
|
||||
async_shutdown_impl (handler);
|
||||
return async_shutdown (ErrorCall (handler));
|
||||
}
|
||||
|
||||
virtual void async_shutdown_impl (ErrorCall const& call) = 0;
|
||||
virtual
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
|
||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) call) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,12 +31,18 @@ struct SocketInterface
|
||||
/** Tag for some compatibility with asio::basic_stream_socket
|
||||
http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/basic_stream_socket.html
|
||||
*/
|
||||
struct Stream { };
|
||||
struct SyncStream { };
|
||||
struct AsyncStream { };
|
||||
struct Stream : SyncStream, AsyncStream { };
|
||||
|
||||
/** Tag for some compatibility with asio::ssl::stream
|
||||
/** Tags for compatibility with asio::ssl::stream
|
||||
http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream.html
|
||||
*/
|
||||
struct Handshake { };
|
||||
struct SyncHandshake { };
|
||||
struct SyncBufferedHandshake : SyncHandshake { };
|
||||
struct AsyncHandshake { };
|
||||
struct AsyncBufferedHandshake : AsyncHandshake{ };
|
||||
struct Handshake : SyncBufferedHandshake, AsyncBufferedHandshake { };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,12 +40,11 @@ class SocketWrapper
|
||||
public:
|
||||
typedef Object ObjectType;
|
||||
typedef typename boost::remove_reference <Object>::type ObjectT;
|
||||
typedef typename boost::remove_reference <Object>::type next_layer_type;
|
||||
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
|
||||
typedef boost::asio::ssl::stream_base::handshake_type handshake_type;
|
||||
|
||||
SocketWrapper (Object& object) noexcept
|
||||
: m_impl (&object)
|
||||
//, m_next_layer (object.next_layer ())
|
||||
//, m_lowest_layer (object.lowest_layer ())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -71,6 +70,12 @@ public:
|
||||
return get_object ().get_io_service ();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
typedef typename boost::remove_reference <Object>::type next_layer_type;
|
||||
typedef typename next_layer_type::lowest_layer_type lowest_layer_type;
|
||||
|
||||
next_layer_type& next_layer () noexcept
|
||||
{
|
||||
return get_object ().next_layer ();
|
||||
@@ -90,6 +95,7 @@ public:
|
||||
{
|
||||
return get_object ().lowest_layer ();
|
||||
}
|
||||
#endif
|
||||
|
||||
// General
|
||||
|
||||
@@ -103,85 +109,383 @@ public:
|
||||
return m_impl;
|
||||
}
|
||||
|
||||
// Socket
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// SocketInterface::Socket
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
boost::system::error_code cancel (boost::system::error_code& ec)
|
||||
{
|
||||
return cancel (ec, HasInterface <ObjectT, SocketInterface::Socket> ());
|
||||
return cancel (ec,
|
||||
HasInterface <ObjectT, SocketInterface::Socket> ());
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
boost::system::error_code cancel (boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().cancel (ec);
|
||||
}
|
||||
|
||||
boost::system::error_code cancel (boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
return pure_virtual (ec);
|
||||
}
|
||||
|
||||
public:
|
||||
boost::system::error_code shutdown (shutdown_type what, boost::system::error_code& ec)
|
||||
{
|
||||
return shutdown (what, ec, HasInterface <ObjectT, SocketInterface::Socket> ());
|
||||
return shutdown (what, ec,
|
||||
HasInterface <ObjectT, SocketInterface::Socket> ());
|
||||
}
|
||||
|
||||
private:
|
||||
boost::system::error_code shutdown (Socket::shutdown_type what, boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().shutdown (what, ec);
|
||||
}
|
||||
|
||||
boost::system::error_code shutdown (Socket::shutdown_type, boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
return pure_virtual (ec);
|
||||
}
|
||||
|
||||
public:
|
||||
boost::system::error_code close (boost::system::error_code& ec)
|
||||
{
|
||||
return close (ec, HasInterface <ObjectT, SocketInterface::Socket> ());
|
||||
return close (ec,
|
||||
HasInterface <ObjectT, SocketInterface::Socket> ());
|
||||
}
|
||||
|
||||
// Stream
|
||||
private:
|
||||
boost::system::error_code close (boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().close (ec);
|
||||
}
|
||||
|
||||
std::size_t read_some_impl (Socket::MutableBuffers const& buffers,
|
||||
boost::system::error_code close (boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
return pure_virtual (ec);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// SocketInterface::Stream
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
std::size_t read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
return read_some (buffers, ec, HasInterface <ObjectT, SocketInterface::Stream> ());
|
||||
return read_some (buffers, ec,
|
||||
HasInterface <ObjectT, SocketInterface::SyncStream> ());
|
||||
}
|
||||
|
||||
std::size_t write_some_impl (Socket::ConstBuffers const& buffers,
|
||||
boost::system::error_code& ec)
|
||||
private:
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some (MutableBufferSequence const& buffers, boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
return write_some (buffers, ec, HasInterface <ObjectT, SocketInterface::Stream> ());
|
||||
return get_object ().read_some (buffers, ec);
|
||||
}
|
||||
|
||||
void async_read_some_impl (Socket::MutableBuffers const& buffers,
|
||||
TransferCall const& call)
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some (MutableBufferSequence const&, boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
async_read_some (buffers, call, HasInterface <ObjectT, SocketInterface::Stream> ());
|
||||
pure_virtual (ec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void async_write_some_impl (Socket::ConstBuffers const& buffers,
|
||||
TransferCall const& call)
|
||||
public:
|
||||
std::size_t write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec)
|
||||
{
|
||||
async_write_some (buffers, call, HasInterface <ObjectT, SocketInterface::Stream> ());
|
||||
return write_some (buffers, ec,
|
||||
HasInterface <ObjectT, SocketInterface::SyncStream> ());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some (ConstBufferSequence const& buffers, boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().write_some (buffers, ec);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some (ConstBufferSequence const&, boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
pure_virtual (ec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public:
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
||||
async_read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call)
|
||||
{
|
||||
return async_read_some (buffers, call,
|
||||
HasInterface <ObjectT, SocketInterface::AsyncStream> ());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))
|
||||
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().async_read_some (buffers, handler);
|
||||
}
|
||||
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))
|
||||
async_read_some (MutableBufferSequence const&, BOOST_ASIO_MOVE_ARG(ReadHandler),
|
||||
boost::false_type)
|
||||
{
|
||||
#if BOOST_ASIO_HAS_FUTURE_RETURNS
|
||||
boost::asio::detail::async_result_init<
|
||||
ReadHandler, void (boost::system::error_code, std::size_t)> init(
|
||||
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec, 0));
|
||||
return init.result.get();
|
||||
#else
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec, 0));
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
||||
async_write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call)
|
||||
{
|
||||
return async_write_some (buffers, call,
|
||||
HasInterface <ObjectT, SocketInterface::AsyncStream> ());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (boost::system::error_code, std::size_t))
|
||||
async_write_some (ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().async_write_some (buffers, handler);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (boost::system::error_code, std::size_t))
|
||||
async_write_some (ConstBufferSequence const&, BOOST_ASIO_MOVE_ARG(WriteHandler),
|
||||
boost::false_type)
|
||||
{
|
||||
#if BOOST_ASIO_HAS_FUTURE_RETURNS
|
||||
boost::asio::detail::async_result_init<
|
||||
WriteHandler, void (boost::system::error_code, std::size_t)> init(
|
||||
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec, 0));
|
||||
return init.result.get();
|
||||
#else
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec, 0));
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Handshake
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
public:
|
||||
boost::system::error_code handshake (handshake_type type, boost::system::error_code& ec)
|
||||
{
|
||||
return handshake (type, ec, HasInterface <ObjectT, SocketInterface::Handshake> ());
|
||||
return handshake (type, ec,
|
||||
HasInterface <ObjectT, SocketInterface::SyncHandshake> ());
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION / 100) >= 1054
|
||||
boost::system::error_code handshake_impl (handshake_type role,
|
||||
Socket::ConstBuffers const& buffers, boost::system::error_code& ec)
|
||||
private:
|
||||
boost::system::error_code handshake (handshake_type type, boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
return handshake (role, buffers, ec, HasInterface <ObjectT, SocketInterface::Handshake> ());
|
||||
}
|
||||
#endif
|
||||
|
||||
void async_handshake_impl (handshake_type role, ErrorCall const& call)
|
||||
{
|
||||
async_handshake (role, call, HasInterface <ObjectT, SocketInterface::Handshake> ());
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION / 100) >= 1054
|
||||
void async_handshake_impl (handshake_type role,
|
||||
Socket::ConstBuffers const& buffers, TransferCall const& call)
|
||||
{
|
||||
async_handshake (role, buffers, call, HasInterface <ObjectT, SocketInterface::Handshake> ());
|
||||
return get_object ().handshake (type, ec);
|
||||
}
|
||||
|
||||
boost::system::error_code handshake (handshake_type, boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
return pure_virtual (ec);
|
||||
}
|
||||
|
||||
public:
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
|
||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) call)
|
||||
{
|
||||
return async_handshake (type, call,
|
||||
HasInterface <ObjectT, SocketInterface::AsyncHandshake> ());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename HandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (boost::system::error_code))
|
||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().async_handshake (type, handler);
|
||||
}
|
||||
|
||||
template <typename HandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (boost::system::error_code))
|
||||
async_handshake (handshake_type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler,
|
||||
boost::false_type)
|
||||
{
|
||||
#if BOOST_ASIO_HAS_FUTURE_RETURNS
|
||||
boost::asio::detail::async_result_init<
|
||||
HandshakeHandler, void (boost::system::error_code)> init(
|
||||
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec));
|
||||
return init.result.get();
|
||||
#else
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec));
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
#if BOOST_ASIO_HAS_BUFFEREDHANDSHAKE
|
||||
boost::system::error_code handshake (handshake_type type,
|
||||
BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec)
|
||||
{
|
||||
return handshake (type, buffers, ec,
|
||||
HasInterface <ObjectT, SocketInterface::SyncBufferedHandshake> ());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename ConstBufferSequence>
|
||||
boost::system::error_code handshake (handshake_type type,
|
||||
ConstBufferSequence const& buffers, boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().handshake (type, buffers, ec);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence>
|
||||
boost::system::error_code handshake (handshake_type,
|
||||
ConstBufferSequence const&, boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
return pure_virtual (ec);
|
||||
}
|
||||
|
||||
public:
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
|
||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers,
|
||||
BOOST_ASIO_MOVE_ARG(TransferCall) call)
|
||||
{
|
||||
return async_handshake (type, buffers, call,
|
||||
HasInterface <ObjectT, SocketInterface::AsyncBufferedHandshake> ());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void (boost::system::error_code, std::size_t))
|
||||
async_handshake (handshake_type type, const ConstBufferSequence& buffers,
|
||||
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().async_handshake (type, buffers, handler);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void (boost::system::error_code, std::size_t))
|
||||
async_handshake (handshake_type, const ConstBufferSequence&,
|
||||
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler,
|
||||
boost::false_type)
|
||||
{
|
||||
#if BOOST_ASIO_HAS_FUTURE_RETURNS
|
||||
boost::asio::detail::async_result_init<
|
||||
BufferedHandshakeHandler, void (boost::system::error_code, std::size_t)> init(
|
||||
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler));
|
||||
boost::system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec, 0));
|
||||
return init.result.get();
|
||||
#else
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec, 0));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
boost::system::error_code shutdown (boost::system::error_code& ec)
|
||||
{
|
||||
return shutdown (ec, HasInterface <ObjectT, SocketInterface::Handshake> ());
|
||||
return shutdown (ec,
|
||||
HasInterface <ObjectT, SocketInterface::SyncHandshake> ());
|
||||
}
|
||||
|
||||
void async_shutdown_impl (ErrorCall const& call)
|
||||
private:
|
||||
boost::system::error_code shutdown (boost::system::error_code& ec,
|
||||
boost::true_type)
|
||||
{
|
||||
async_shutdown (call, HasInterface <ObjectT, SocketInterface::Handshake> ());
|
||||
return get_object ().shutdown (ec);
|
||||
}
|
||||
|
||||
boost::system::error_code shutdown (boost::system::error_code& ec,
|
||||
boost::false_type)
|
||||
{
|
||||
return pure_virtual (ec);
|
||||
}
|
||||
|
||||
public:
|
||||
void async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) call)
|
||||
{
|
||||
async_shutdown (call,
|
||||
HasInterface <ObjectT, SocketInterface::AsyncHandshake> ());
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename ShutdownHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ShutdownHandler, void (boost::system::error_code))
|
||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler,
|
||||
boost::true_type)
|
||||
{
|
||||
return get_object ().async_shutdown (handler);
|
||||
}
|
||||
|
||||
template <typename ShutdownHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ShutdownHandler, void (boost::system::error_code))
|
||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler,
|
||||
boost::false_type)
|
||||
{
|
||||
#if BOOST_ASIO_HAS_FUTURE_RETURNS
|
||||
boost::asio::detail::async_result_init<
|
||||
ShutdownHandler, void (boost::system::error_code, std::size_t)> init(
|
||||
BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler));
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec));
|
||||
return init.result.get();
|
||||
#else
|
||||
system::error_code ec;
|
||||
ec = pure_virtual (ec);
|
||||
get_io_service ().post (boost::bind (handler, ec));
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -196,197 +500,16 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
static boost::system::error_code fail (boost::system::error_code const& ec = boost::system::error_code ())
|
||||
static void pure_virtual ()
|
||||
{
|
||||
fatal_error ("pure virtual");
|
||||
return ec;
|
||||
fatal_error ("A beast::Socket function was called on an object that doesn't support the interface");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Socket
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
boost::system::error_code cancel (boost::system::error_code& ec, boost::true_type)
|
||||
static boost::system::error_code pure_virtual (boost::system::error_code& ec)
|
||||
{
|
||||
return get_object ().cancel (ec);
|
||||
}
|
||||
|
||||
boost::system::error_code cancel (boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
return fail ();
|
||||
}
|
||||
|
||||
boost::system::error_code shutdown (Socket::shutdown_type what, boost::system::error_code& ec, boost::true_type)
|
||||
{
|
||||
return get_object ().shutdown (what, ec);
|
||||
}
|
||||
|
||||
boost::system::error_code shutdown (Socket::shutdown_type, boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
return fail ();
|
||||
}
|
||||
|
||||
boost::system::error_code close (boost::system::error_code& ec, boost::true_type)
|
||||
{
|
||||
return get_object ().close (ec);
|
||||
}
|
||||
|
||||
boost::system::error_code close (boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
return fail ();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Stream
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some (MutableBufferSequence const& buffers, boost::system::error_code& ec, boost::true_type)
|
||||
{
|
||||
return get_object ().read_some (buffers, ec);
|
||||
}
|
||||
|
||||
template <typename MutableBufferSequence>
|
||||
std::size_t read_some (MutableBufferSequence const&, boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some (ConstBufferSequence const& buffers, boost::system::error_code& ec, boost::true_type)
|
||||
{
|
||||
return get_object ().write_some (buffers, ec);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence>
|
||||
std::size_t write_some (ConstBufferSequence const&, boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))
|
||||
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, boost::true_type)
|
||||
{
|
||||
get_object ().async_read_some (buffers, handler);
|
||||
}
|
||||
|
||||
template <typename MutableBufferSequence, typename ReadHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))
|
||||
async_read_some (MutableBufferSequence const&, BOOST_ASIO_MOVE_ARG(ReadHandler), boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (boost::system::error_code, std::size_t))
|
||||
async_write_some (ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler, boost::true_type)
|
||||
{
|
||||
return get_object ().async_write_some (buffers, handler);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence, typename WriteHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (boost::system::error_code, std::size_t))
|
||||
async_write_some (ConstBufferSequence const&, BOOST_ASIO_MOVE_ARG(WriteHandler), boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Handshake
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
boost::system::error_code handshake (handshake_type type, boost::system::error_code& ec, boost::true_type)
|
||||
{
|
||||
return get_object ().handshake (type, ec);
|
||||
}
|
||||
|
||||
boost::system::error_code handshake (handshake_type, boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
return boost::system::error_code ();
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION / 100) >= 1054
|
||||
template <typename ConstBufferSequence>
|
||||
boost::system::error_code handshake (handshake_type type, ConstBufferSequence const& buffers,
|
||||
boost::system::error_code& ec, boost::true_type)
|
||||
{
|
||||
return get_object ().handshake (type, buffers, ec);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence>
|
||||
boost::system::error_code handshake (handshake_type, ConstBufferSequence const&,
|
||||
boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
return boost::system::error_code ();
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename HandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (boost::system::error_code))
|
||||
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler, boost::true_type)
|
||||
{
|
||||
return get_object ().async_handshake (type, handler);
|
||||
}
|
||||
|
||||
template <typename HandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (boost::system::error_code))
|
||||
async_handshake (handshake_type, BOOST_ASIO_MOVE_ARG(HandshakeHandler), boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION / 100) >= 1054
|
||||
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void (boost::system::error_code, std::size_t))
|
||||
async_handshake (handshake_type type, const ConstBufferSequence& buffers,
|
||||
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler, boost::true_type)
|
||||
{
|
||||
return get_object ().async_handshake (type, buffers, handler);
|
||||
}
|
||||
|
||||
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void (boost::system::error_code, std::size_t))
|
||||
async_handshake (handshake_type, const ConstBufferSequence&,
|
||||
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler), boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
}
|
||||
#endif
|
||||
|
||||
boost::system::error_code shutdown (boost::system::error_code& ec, boost::true_type)
|
||||
{
|
||||
return get_object ().shutdown (ec);
|
||||
}
|
||||
|
||||
boost::system::error_code shutdown (boost::system::error_code&, boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
return boost::system::error_code ();
|
||||
}
|
||||
|
||||
template <typename ShutdownHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ShutdownHandler, void (boost::system::error_code))
|
||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler, boost::true_type)
|
||||
{
|
||||
return get_object ().async_shutdown (handler);
|
||||
}
|
||||
|
||||
template <typename ShutdownHandler>
|
||||
BOOST_ASIO_INITFN_RESULT_TYPE(ShutdownHandler, void (boost::system::error_code))
|
||||
async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler), boost::false_type)
|
||||
{
|
||||
fail ();
|
||||
pure_virtual ();
|
||||
return ec = boost::system::errc::make_error_code (
|
||||
boost::system::errc::function_not_supported);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
81
modules/beast_asio/system/beast_BoostIncludes.h
Normal file
81
modules/beast_asio/system/beast_BoostIncludes.h
Normal file
@@ -0,0 +1,81 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
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.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_BOOSTINCLUDES_H_INCLUDED
|
||||
#define BEAST_BOOSTINCLUDES_H_INCLUDED
|
||||
|
||||
// Make sure we take care of fixing boost::bind oddities first.
|
||||
#if !defined(BEAST_CORE_H_INCLUDED)
|
||||
#error beast_core.h must be included before including this file
|
||||
#endif
|
||||
|
||||
// These should have already been set in your project, but
|
||||
// if you forgot then we will be optimistic and choose the latest.
|
||||
//
|
||||
#if BEAST_WIN32
|
||||
# ifndef _WIN32_WINNT
|
||||
# pragma message ("Warning: _WIN32_WINNT was not set in your project")
|
||||
# define _WIN32_WINNT 0x0600
|
||||
# endif
|
||||
# ifndef _VARIADIC_MAX
|
||||
# define _VARIADIC_MAX 10
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
//#include <boost/mpl/at.hpp>
|
||||
//#include <boost/asio/io_service.hpp>
|
||||
//#include <boost/array.hpp>
|
||||
//#include <boost/bind.hpp>
|
||||
//#include <boost/unordered_map.hpp>
|
||||
//#include <boost/mpl/vector.hpp>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Configure some options based on the version of boost
|
||||
#include <boost/version.hpp>
|
||||
#if (BOOST_VERSION / 100) >= 1054
|
||||
# define BOOST_ASIO_HAS_BUFFEREDHANDSHAKE 1
|
||||
# define BOOST_ASIO_HAS_FUTURE_RETURNS 1
|
||||
#else
|
||||
# define BOOST_ASIO_HAS_BUFFEREDHANDSHAKE 0
|
||||
# define BOOST_ASIO_HAS_FUTURE_RETURNS 0
|
||||
#endif
|
||||
|
||||
#if ! BOOST_ASIO_HAS_FUTURE_RETURNS
|
||||
# define BOOST_ASIO_INITFN_RESULT_TYPE(expr,val) void
|
||||
# define BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(expr,val) void
|
||||
#else
|
||||
# if defined(GENERATING_DOCUMENTATION)
|
||||
# define BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(h, sig) \
|
||||
void_or_deduced
|
||||
# elif defined(_MSC_VER) && (_MSC_VER < 1500)
|
||||
# define BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(h, sig) \
|
||||
::boost::asio::detail::async_result_type_helper<h, sig>::type
|
||||
# else
|
||||
# define BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(h, sig) \
|
||||
::boost::asio::async_result <::boost::asio::handler_type<h, sig>::type>::type
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user