#endif
#include <assert.h>
+
#include <rdr/AESInStream.h>
-#include <rdr/Exception.h>
#ifdef HAVE_NETTLE
using namespace rdr;
EAX_DIGEST(&eaxCtx256, aes256_encrypt, 16, macComputed);
}
if (memcmp(mac, macComputed, 16) != 0)
- throw Exception("AESInStream: failed to authenticate message");
+ throw std::runtime_error("AESInStream: failed to authenticate message");
in->setptr(2 + length + 16);
end += length;
GAIException::GAIException(const char* s, int err_)
- : Exception(rfb::format("%s: %s (%d)", s, strerror(err_).c_str(), err_)),
+ : std::runtime_error(rfb::format("%s: %s (%d)", s,
+ strerror(err_).c_str(), err_)),
+ err(err_)
+{
+}
+
+GAIException::GAIException(const std::string& s, int err_)
+ : std::runtime_error(rfb::format("%s: %s (%d)", s.c_str(),
+ strerror(err_).c_str(), err_)),
err(err_)
{
}
#endif
}
-PosixException::PosixException(const char* s, int err_)
- : Exception(rfb::format("%s: %s (%d)", s, strerror(err_).c_str(), err_)),
+PosixException::PosixException(const char* what_arg, int err_)
+ : std::runtime_error(rfb::format("%s: %s (%d)", what_arg,
+ strerror(err_).c_str(), err_)),
+ err(err_)
+{
+}
+
+PosixException::PosixException(const std::string& what_arg, int err_)
+ : std::runtime_error(rfb::format("%s: %s (%d)", what_arg.c_str(),
+ strerror(err_).c_str(), err_)),
err(err_)
{
}
}
#ifdef WIN32
-Win32Exception::Win32Exception(const char* s, unsigned err_)
- : Exception(rfb::format("%s: %s (%d)", s, strerror(err_).c_str(), err_)),
+Win32Exception::Win32Exception(const char* what_arg, unsigned err_)
+ : std::runtime_error(rfb::format("%s: %s (%d)", what_arg,
+ strerror(err_).c_str(), err_)),
+ err(err_)
+{
+}
+
+Win32Exception::Win32Exception(const std::string& what_arg, unsigned err_)
+ : std::runtime_error(rfb::format("%s: %s (%d)", what_arg.c_str(),
+ strerror(err_).c_str(), err_)),
err(err_)
{
}
namespace rdr {
- class Exception : public std::runtime_error {
+ class PosixException : public std::runtime_error {
public:
- Exception(const char* what_arg) : std::runtime_error(what_arg) {}
- Exception(const std::string& what_arg) : std::runtime_error(what_arg) {}
- };
-
- struct PosixException : public Exception {
int err;
- PosixException(const char* s, int err_);
+ PosixException(const char* what_arg, int err_);
+ PosixException(const std::string& what_arg, int err_);
private:
std::string strerror(int err_) const;
};
#ifdef WIN32
- struct Win32Exception : public Exception {
+ class Win32Exception : public std::runtime_error {
+ public:
unsigned err;
- Win32Exception(const char* s, unsigned err_);
+ Win32Exception(const char* what_arg, unsigned err_);
+ Win32Exception(const std::string& what_arg, unsigned err_);
private:
std::string strerror(unsigned err_) const;
};
#endif
#ifdef WIN32
- struct SocketException : public Win32Exception {
- SocketException(const char* text, unsigned err_) : Win32Exception(text, err_) {}
+ class SocketException : public Win32Exception {
+ public:
+ SocketException(const char* what_arg, unsigned err_) : Win32Exception(what_arg, err_) {}
+ SocketException(const std::string& what_arg, unsigned err_) : Win32Exception(what_arg, err_) {}
};
#else
- struct SocketException : public PosixException {
- SocketException(const char* text, int err_) : PosixException(text, err_) {}
+ class SocketException : public PosixException {
+ public:
+ SocketException(const char* what_arg, unsigned err_) : PosixException(what_arg, err_) {}
+ SocketException(const std::string& what_arg, unsigned err_) : PosixException(what_arg, err_) {}
};
#endif
- struct GAIException : public Exception {
+ class GAIException : public std::runtime_error {
+ public:
int err;
GAIException(const char* s, int err_);
+ GAIException(const std::string& s, int err_);
private:
std::string strerror(int err_) const;
};
- struct EndOfStream : public Exception {
- EndOfStream() : Exception("End of stream") {}
+ class EndOfStream : public std::runtime_error {
+ public:
+ EndOfStream() : std::runtime_error("End of stream") {}
};
}
#ifdef HAVE_GNUTLS
TLSException::TLSException(const char* s, int err_)
- : Exception(rfb::format("%s: %s (%d)", s, gnutls_strerror(err_), err_)),
+ : std::runtime_error(rfb::format("%s: %s (%d)", s,
+ gnutls_strerror(err_), err_)),
err(err_)
{
}
namespace rdr {
- struct TLSException : public Exception {
+ class TLSException : public std::runtime_error {
+ public:
int err;
TLSException(const char* s, int err_);
};
#ifndef __RFB_EXCEPTION_H__
#define __RFB_EXCEPTION_H__
-#include <rdr/Exception.h>
+#include <stdexcept>
namespace rfb {
- typedef rdr::Exception Exception;
-
- class ProtocolException : public Exception {
+ class ProtocolException : public std::runtime_error {
public:
- ProtocolException(const char* what_arg) : Exception(what_arg) {}
- ProtocolException(const std::string& what_arg) : Exception(what_arg) {}
+ ProtocolException(const char* what_arg) : std::runtime_error(what_arg) {}
+ ProtocolException(const std::string& what_arg) : std::runtime_error(what_arg) {}
};
- struct AuthFailureException : public Exception {
- AuthFailureException(const char* reason)
- : Exception(reason) {}
- AuthFailureException(std::string& reason)
- : Exception(reason) {}
+ class AuthFailureException : public std::runtime_error {
+ public:
+ AuthFailureException(const char* reason) : std::runtime_error(reason) {}
+ AuthFailureException(std::string& reason) : std::runtime_error(reason) {}
};
- struct AuthCancelledException : public rfb::Exception {
+
+ class AuthCancelledException : public std::runtime_error {
+ public:
AuthCancelledException()
- : Exception("Authentication cancelled") {}
+ : std::runtime_error("Authentication cancelled") {}
};
}
#endif
#include <nettle/base64.h>
#include <nettle/asn1.h>
+#include <rdr/AESInStream.h>
+#include <rdr/AESOutStream.h>
+#include <rdr/Exception.h>
+
#include <rfb/SSecurityRSAAES.h>
#include <rfb/SConnection.h>
#include <rfb/LogWriter.h>
#include <rfb/Exception.h>
-#include <rdr/AESInStream.h>
-#include <rdr/AESOutStream.h>
#if !defined(WIN32) && !defined(__APPLE__)
#include <rfb/UnixPasswordValidator.h>
#endif
#include <config.h>
#endif
+#include <rdr/Exception.h>
+
#include <network/TcpSocket.h>
#include <rfb/ComparingUpdateTracker.h>
#include <unistd.h>
#endif
+#include <rdr/Exception.h>
+
#include <rfb/CMsgWriter.h>
#include <rfb/CSecurity.h>
#include <rfb/Exception.h>
#include <FL/Fl_File_Chooser.H>
#include <os/os.h>
-#include <rfb/Exception.h>
+
+#include <rdr/Exception.h>
+
#include <rfb/Hostname.h>
#include <rfb/LogWriter.h>
#include <rfb/util.h>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Pixmap.H>
+#include <rdr/Exception.h>
+
#include <rfb/Exception.h>
#include <rfb/obfuscate.h>
#include "parameters.h"
#include <os/os.h>
-#include <rfb/Exception.h>
+
+#include <rdr/Exception.h>
+
#include <rfb/LogWriter.h>
#include <rfb/SecurityClient.h>
#include <rfb/util.h>
#include <config.h>
#endif
+#include <rdr/Exception.h>
+
#include <rfb_win32/Clipboard.h>
#include <rfb_win32/WMShatter.h>
#include <rfb/util.h>
#include <config.h>
#endif
+#include <rdr/Exception.h>
+
#include <rfb_win32/DIBSectionBuffer.h>
#include <rfb_win32/DeviceContext.h>
#include <rfb_win32/BitmapInfo.h>
#include <config.h>
#endif
+#include <rdr/Exception.h>
+
#include <rfb_win32/WMPoller.h>
-#include <rfb/Exception.h>
#include <rfb/LogWriter.h>
#include <rfb/Configuration.h>