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 "XSynergy.h"
#include "XIO.h"
using namespace CryptoPP;
@ -47,7 +47,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
break;
default:
throw XBadCryptoMode();
throw XIOBadCryptoMode();
}
}
else {
@ -72,7 +72,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) :
break;
default:
throw XBadCryptoMode();
throw XIOBadCryptoMode();
}
}
}

View File

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

View File

@ -20,6 +20,10 @@ set(inc
IStream.h
IStreamFilterFactory.h
XIO.h
CCryptoStream.h
CCryptoMode.h
ECryptoMode.h
CCryptoOptions.h
)
set(src
@ -27,6 +31,9 @@ set(src
CStreamFilter.cpp
IStream.cpp
XIO.cpp
CCryptoStream.cpp
CCryptoMode.cpp
CCryptoOptions.cpp
)
if (WIN32)
@ -37,6 +44,8 @@ set(inc
../arch
../base
../common
../..
../../../tools
)
if (UNIX)
@ -47,3 +56,7 @@ endif()
include_directories(${inc})
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");
}
//
// 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);
//! I/O bad crypto mode exception
/*!
Thrown when the user enters an invalid crypto mode.
*/
XBASE_SUBCLASS_WHAT(XIOBadCryptoMode, XIO);
#endif

View File

@ -50,10 +50,6 @@ set(inc
IAppUtil.h
CEventGameDevice.h
CVncClient.h
CCryptoStream.h
CCryptoMode.h
ECryptoMode.h
CCryptoOptions.h
)
set(src
@ -84,10 +80,7 @@ set(src
CArgsBase.cpp
CEventGameDevice.cpp
CVncClient.cpp
CGameDevice.cpp
CCryptoStream.cpp
CCryptoMode.cpp
CCryptoOptions.cpp
CGameDevice.cpp
)
if (WIN32)
@ -136,5 +129,5 @@ include_directories(${inc})
add_library(synergy STATIC ${src})
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()

View File

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

View File

@ -30,12 +30,6 @@ Thrown when the client fails to follow the protocol.
*/
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
/*!
Thrown when a client attempting to connect has an incompatible version.