mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add SSLContext
This commit is contained in:
@@ -16,3 +16,13 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
SSLContext::SSLContext (ContextType& context)
|
||||
: m_context (context)
|
||||
{
|
||||
}
|
||||
|
||||
SSLContext::~SSLContext ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,25 +17,45 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_SSLCONTEXT_H_INCLUDED
|
||||
#define BEAST_SSLCONTEXT_H_INCLUDED
|
||||
#ifndef BEAST_ASIO_BASICS_SSLCONTEXT_H_INCLUDED
|
||||
#define BEAST_ASIO_BASICS_SSLCONTEXT_H_INCLUDED
|
||||
|
||||
/** An SSL context that wraps a boost::asio::ssl::context. */
|
||||
class SslContextBase
|
||||
/** Simple base class for passing a context around.
|
||||
This lets derived classes hide their implementation from the headers.
|
||||
*/
|
||||
class SSLContext : public Uncopyable
|
||||
{
|
||||
public:
|
||||
typedef boost::asio::ssl::context BoostContextType;
|
||||
virtual ~SslContextBase () { }
|
||||
virtual ~SSLContext ();
|
||||
|
||||
/** Conversion to boost::asio::ssl::context
|
||||
This lets you pass this object where the real thing is expected.
|
||||
*/
|
||||
operator BoostContextType& ()
|
||||
// Saves typing
|
||||
typedef boost::asio::ssl::context ContextType;
|
||||
|
||||
inline ContextType& get () noexcept
|
||||
{
|
||||
return getBoostContext ();
|
||||
return m_context;
|
||||
}
|
||||
|
||||
virtual BoostContextType& getBoostContext () noexcept = 0;
|
||||
inline ContextType const& get () const noexcept
|
||||
{
|
||||
return m_context;
|
||||
}
|
||||
|
||||
// implicit conversion
|
||||
inline operator ContextType& () noexcept
|
||||
{
|
||||
return get ();
|
||||
}
|
||||
|
||||
inline operator ContextType const& () const noexcept
|
||||
{
|
||||
return get ();
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit SSLContext (ContextType& context);
|
||||
|
||||
ContextType& m_context;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -29,10 +29,10 @@ namespace beast
|
||||
#include "async/beast_SharedHandler.cpp"
|
||||
|
||||
#include "basics/beast_PeerRole.cpp"
|
||||
#include "basics/SSLContext.cpp"
|
||||
|
||||
#include "sockets/beast_SocketBase.cpp"
|
||||
#include "sockets/beast_Socket.cpp"
|
||||
#include "sockets/beast_SslContext.cpp"
|
||||
|
||||
#include "handshake/beast_HandshakeDetectLogicPROXY.cpp"
|
||||
|
||||
|
||||
@@ -73,12 +73,12 @@ namespace beast
|
||||
#include "basics/beast_BufferType.h"
|
||||
#include "basics/beast_FixedInputBuffer.h"
|
||||
#include "basics/beast_PeerRole.h"
|
||||
#include "basics/SSLContext.h"
|
||||
|
||||
#include "sockets/beast_SocketBase.h"
|
||||
#include "sockets/beast_Socket.h"
|
||||
#include "sockets/beast_SocketWrapper.h"
|
||||
#include "sockets/SocketWrapperStrand.h"
|
||||
#include "sockets/beast_SslContext.h"
|
||||
|
||||
#include "handshake/beast_InputParser.h"
|
||||
#include "handshake/beast_HandshakeDetectLogic.h"
|
||||
|
||||
Reference in New Issue
Block a user