Add SSLContext

This commit is contained in:
Vinnie Falco
2013-08-24 21:12:12 -07:00
parent 0aa7e871d1
commit 46e5dc2f5c
6 changed files with 58 additions and 30 deletions

View File

@@ -16,3 +16,13 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
SSLContext::SSLContext (ContextType& context)
: m_context (context)
{
}
SSLContext::~SSLContext ()
{
}

View File

@@ -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

View File

@@ -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"

View File

@@ -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"