Add SSLContext

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

View File

@@ -77,6 +77,7 @@
<ClInclude Include="..\..\modules\beast_asio\basics\beast_BufferType.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\beast_FixedInputBuffer.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\beast_PeerRole.h" />
<ClInclude Include="..\..\modules\beast_asio\basics\SSLContext.h" />
<ClInclude Include="..\..\modules\beast_asio\beast_asio.h" />
<ClInclude Include="..\..\modules\beast_asio\handshake\beast_HandshakeDetectLogic.h" />
<ClInclude Include="..\..\modules\beast_asio\handshake\beast_HandshakeDetectLogicPROXY.h" />
@@ -88,7 +89,6 @@
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_Socket.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketBase.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketWrapper.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SslContext.h" />
<ClInclude Include="..\..\modules\beast_asio\sockets\SocketWrapperStrand.h" />
<ClInclude Include="..\..\modules\beast_asio\system\beast_BoostIncludes.h" />
<ClInclude Include="..\..\modules\beast_asio\system\beast_OpenSSLIncludes.h" />
@@ -333,6 +333,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\basics\SSLContext.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\beast_asio.cpp" />
<ClCompile Include="..\..\modules\beast_asio\handshake\beast_HandshakeDetectLogicPROXY.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@@ -352,12 +356,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\sockets\beast_SslContext.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\system\beast_BoostUnitTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>

View File

@@ -686,9 +686,6 @@
<ClInclude Include="..\..\modules\beast_core\diagnostic\beast_SemanticVersion.h">
<Filter>beast_core\diagnostic</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\beast_asio.h">
<Filter>beast_asio</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SocketBase.h">
<Filter>beast_asio\sockets</Filter>
</ClInclude>
@@ -701,9 +698,6 @@
<ClInclude Include="..\..\modules\beast_asio\system\beast_BoostIncludes.h">
<Filter>beast_asio\system</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\sockets\beast_SslContext.h">
<Filter>beast_asio\sockets</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\tests\beast_TestPeer.h">
<Filter>beast_asio\tests</Filter>
</ClInclude>
@@ -911,6 +905,12 @@
<ClInclude Include="..\..\modules\beast_asio\sockets\SocketWrapperStrand.h">
<Filter>beast_asio\sockets</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\basics\SSLContext.h">
<Filter>beast_asio\basics</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_asio\beast_asio.h">
<Filter>beast_asio</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\modules\beast_core\beast_core.cpp">
@@ -1282,9 +1282,6 @@
<ClCompile Include="..\..\modules\beast_asio\beast_asio.cpp">
<Filter>beast_asio</Filter>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\sockets\beast_SslContext.cpp">
<Filter>beast_asio\sockets</Filter>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\tests\beast_TestPeerBasics.cpp">
<Filter>beast_asio\tests</Filter>
</ClCompile>
@@ -1387,6 +1384,9 @@
<ClCompile Include="..\..\modules\beast_core\memory\beast_PagedFreeStore.cpp">
<Filter>beast_core\memory</Filter>
</ClCompile>
<ClCompile Include="..\..\modules\beast_asio\basics\SSLContext.cpp">
<Filter>beast_asio\basics</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="..\..\TODO.txt" />

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"