mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 12:35:50 +00:00
Tidy up beast_asio
This commit is contained in:
@@ -70,7 +70,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\beast_asio.h" />
|
<ClInclude Include="..\..\modules\beast_asio\beast_asio.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\boost\beast_BoostIncludes.h" />
|
|
||||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_Socket.h" />
|
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_Socket.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SharedSocket.h" />
|
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SharedSocket.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketBase.h" />
|
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketBase.h" />
|
||||||
|
|||||||
@@ -146,9 +146,6 @@
|
|||||||
<Filter Include="beast_asio\sockets">
|
<Filter Include="beast_asio\sockets">
|
||||||
<UniqueIdentifier>{af535ad5-a06c-462f-8ac0-8207a708e032}</UniqueIdentifier>
|
<UniqueIdentifier>{af535ad5-a06c-462f-8ac0-8207a708e032}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="beast_asio\boost">
|
|
||||||
<UniqueIdentifier>{4a91e76d-d6ab-4ce9-a451-0c2685cd3064}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
||||||
@@ -752,9 +749,6 @@
|
|||||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketBase.h">
|
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketBase.h">
|
||||||
<Filter>beast_asio\sockets</Filter>
|
<Filter>beast_asio\sockets</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\modules\beast_asio\boost\beast_BoostIncludes.h">
|
|
||||||
<Filter>beast_asio\boost</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketWrapperBase.h">
|
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketWrapperBase.h">
|
||||||
<Filter>beast_asio\sockets</Filter>
|
<Filter>beast_asio\sockets</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -40,8 +40,42 @@
|
|||||||
// Must come before boost includes to fix the bost placeholders.
|
// Must come before boost includes to fix the bost placeholders.
|
||||||
#include "../beast_core/beast_core.h"
|
#include "../beast_core/beast_core.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
/* This module requires boost and possibly OpenSSL */
|
/* This module requires boost and possibly OpenSSL */
|
||||||
#include "boost/beast_BoostIncludes.h"
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace beast
|
namespace beast
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
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
|
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -20,7 +20,14 @@
|
|||||||
#ifndef BEAST_SHAREDSOCKET_H_INCLUDED
|
#ifndef BEAST_SHAREDSOCKET_H_INCLUDED
|
||||||
#define BEAST_SHAREDSOCKET_H_INCLUDED
|
#define BEAST_SHAREDSOCKET_H_INCLUDED
|
||||||
|
|
||||||
/** A Socket interface with reference counting. */
|
/** A Socket interface with reference counting.
|
||||||
|
|
||||||
|
You can keep a pointer to the base class so that you don't have
|
||||||
|
to see the template or underlying object implementation.
|
||||||
|
|
||||||
|
@see SharedSocketTYpe, SharedObjectPtr
|
||||||
|
*/
|
||||||
|
/** @{ */
|
||||||
class SharedSocket
|
class SharedSocket
|
||||||
: public SharedObject
|
: public SharedObject
|
||||||
, public virtual Socket
|
, public virtual Socket
|
||||||
@@ -30,7 +37,28 @@ public:
|
|||||||
typedef SharedObjectPtr <SharedSocket> Ptr;
|
typedef SharedObjectPtr <SharedSocket> Ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A RAII container for wrapping an object as a Socket. */
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** A RAII container for wrapping an object as a Socket.
|
||||||
|
|
||||||
|
To use this, construct the class with an instance of your object
|
||||||
|
created with operator new. The constructor will take ownership,
|
||||||
|
and delete it when the last reference is removed. For example:
|
||||||
|
|
||||||
|
@code
|
||||||
|
|
||||||
|
boost::asio::io_service ios;
|
||||||
|
boost::asio::ssl:context ctx;
|
||||||
|
|
||||||
|
SharedSocket::Ptr mySocket (
|
||||||
|
new (boost::asio::ssl::stream (ios, ctx)));
|
||||||
|
|
||||||
|
mySocket->handshake ();
|
||||||
|
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@see SharedSocket
|
||||||
|
*/
|
||||||
template <class Object>
|
template <class Object>
|
||||||
class SharedSocketType
|
class SharedSocketType
|
||||||
: public SharedSocket
|
: public SharedSocket
|
||||||
@@ -50,5 +78,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
ScopedPointer <Object> m_object;
|
ScopedPointer <Object> m_object;
|
||||||
};
|
};
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ struct SocketWrapperBase
|
|||||||
typedef value type;
|
typedef value type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
// Less elegant, but works.
|
||||||
// Determines if Object supports the specified Interface
|
// Determines if Object supports the specified Interface
|
||||||
template <typename Object, typename Interface, class Enable = void>
|
template <typename Object, typename Interface, class Enable = void>
|
||||||
struct HasInterface : boost::false_type { };
|
struct HasInterface : boost::false_type { };
|
||||||
@@ -83,6 +85,17 @@ struct SocketWrapperBase
|
|||||||
typename boost::enable_if <boost::is_base_of <
|
typename boost::enable_if <boost::is_base_of <
|
||||||
Interface, typename InterfacesOf <Object>::type> >::type >
|
Interface, typename InterfacesOf <Object>::type> >::type >
|
||||||
: boost::true_type { };
|
: boost::true_type { };
|
||||||
|
#else
|
||||||
|
// This should work, but doesn't.
|
||||||
|
// K-ballo from #boost suggested it.
|
||||||
|
//
|
||||||
|
// Determines if Object supports the specified Interface
|
||||||
|
template <typename Object, typename Interface>
|
||||||
|
struct HasInterface : boost::is_base_of <Interface, typename InterfacesOf <Object> >
|
||||||
|
{
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user