moved new crypto stuff into io library, since it inherits CStreamFilter

This commit is contained in:
Nick Bolton 2013-05-30 13:48:08 +00:00
parent e05a9dfa98
commit f4f7f69b3f
13 changed files with 36 additions and 29 deletions

View File

@ -16,7 +16,7 @@
*/ */
#include "CCryptoMode.h" #include "CCryptoMode.h"
#include "XSynergy.h" #include "XIO.h"
using namespace CryptoPP; using namespace CryptoPP;
@ -47,7 +47,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
break; break;
default: default:
throw XBadCryptoMode(); throw XIOBadCryptoMode();
} }
} }
else { else {
@ -72,7 +72,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
break; break;
default: default:
throw XBadCryptoMode(); throw XIOBadCryptoMode();
} }
} }
} }

View File

@ -16,7 +16,7 @@
*/ */
#include "CCryptoOptions.h" #include "CCryptoOptions.h"
#include "XSynergy.h" #include "XIO.h"
CCryptoOptions::CCryptoOptions( CCryptoOptions::CCryptoOptions(
const CString& modeString, const CString& modeString,
@ -49,6 +49,6 @@ CCryptoOptions::parseMode(CString modeString)
return kGcm; return kGcm;
} }
else { else {
throw XBadCryptoMode(); throw XIOBadCryptoMode();
} }
} }

View File

@ -20,6 +20,10 @@ set(inc
IStream.h IStream.h
IStreamFilterFactory.h IStreamFilterFactory.h
XIO.h XIO.h
CCryptoStream.h
CCryptoMode.h
ECryptoMode.h
CCryptoOptions.h
) )
set(src set(src
@ -27,6 +31,9 @@ set(src
CStreamFilter.cpp CStreamFilter.cpp
IStream.cpp IStream.cpp
XIO.cpp XIO.cpp
CCryptoStream.cpp
CCryptoMode.cpp
CCryptoOptions.cpp
) )
if (WIN32) if (WIN32)
@ -37,6 +44,8 @@ set(inc
../arch ../arch
../base ../base
../common ../common
../..
../../../tools
) )
if (UNIX) if (UNIX)
@ -47,3 +56,7 @@ endif()
include_directories(${inc}) include_directories(${inc})
add_library(io STATIC ${src}) add_library(io STATIC ${src})
if (UNIX)
target_link_libraries(io cryptopp)
endif()

View File

@ -49,3 +49,13 @@ XIOWouldBlock::getWhat() const throw()
{ {
return format("XIOWouldBlock", "stream operation would block"); return format("XIOWouldBlock", "stream operation would block");
} }
//
// XBadCryptoMode
//
CString
XIOBadCryptoMode::getWhat() const throw()
{
return "XBadCryptoMode";
}

View File

@ -49,4 +49,10 @@ Thrown if an operation on a stream would block.
*/ */
XBASE_SUBCLASS_WHAT(XIOWouldBlock, XIO); XBASE_SUBCLASS_WHAT(XIOWouldBlock, XIO);
//! I/O bad crypto mode exception
/*!
Thrown when the user enters an invalid crypto mode.
*/
XBASE_SUBCLASS_WHAT(XIOBadCryptoMode, XIO);
#endif #endif

View File

@ -50,10 +50,6 @@ set(inc
IAppUtil.h IAppUtil.h
CEventGameDevice.h CEventGameDevice.h
CVncClient.h CVncClient.h
CCryptoStream.h
CCryptoMode.h
ECryptoMode.h
CCryptoOptions.h
) )
set(src set(src
@ -85,9 +81,6 @@ set(src
CEventGameDevice.cpp CEventGameDevice.cpp
CVncClient.cpp CVncClient.cpp
CGameDevice.cpp CGameDevice.cpp
CCryptoStream.cpp
CCryptoMode.cpp
CCryptoOptions.cpp
) )
if (WIN32) if (WIN32)
@ -136,5 +129,5 @@ include_directories(${inc})
add_library(synergy STATIC ${src}) add_library(synergy STATIC ${src})
if (UNIX) if (UNIX)
target_link_libraries(synergy arch client ipc net base platform mt server cryptopp) target_link_libraries(synergy arch client ipc net base platform mt server)
endif() endif()

View File

@ -29,15 +29,6 @@ XBadClient::getWhat() const throw()
return "XBadClient"; return "XBadClient";
} }
//
// XBadCryptoMode
//
CString
XBadCryptoMode::getWhat() const throw()
{
return "XBadCryptoMode";
}
// //
// XIncompatibleClient // XIncompatibleClient

View File

@ -30,12 +30,6 @@ Thrown when the client fails to follow the protocol.
*/ */
XBASE_SUBCLASS_WHAT(XBadClient, XSynergy); XBASE_SUBCLASS_WHAT(XBadClient, XSynergy);
//! Bad crypto mode
/*!
Thrown when the user enters an invalid crypto mode.
*/
XBASE_SUBCLASS_WHAT(XBadCryptoMode, XSynergy);
//! Incompatible client exception //! Incompatible client exception
/*! /*!
Thrown when a client attempting to connect has an incompatible version. Thrown when a client attempting to connect has an incompatible version.