aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_exceptn.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-28 06:51:44 +0000
committerlloyd <[email protected]>2012-01-28 06:51:44 +0000
commitada0998533c7b6b8eb782c494f8efdf5b6f7f712 (patch)
tree11ce3427ea06995b73fd248cb9417dd3aa837b53 /src/tls/tls_exceptn.h
parentfd6a59f73b4b6d65966b61e8e7a8cda050a4ba43 (diff)
parentaa00e2879f90562bb06146726a602685d6051b6f (diff)
propagate from branch 'net.randombit.botan' (head 3f6b267bc00d2da1b5d36ca2215c3e1b6a40e796)
to branch 'net.randombit.botan.tls-state-machine' (head 7df407e6678bd51328c348fd2a665f20fb22d62d)
Diffstat (limited to 'src/tls/tls_exceptn.h')
-rw-r--r--src/tls/tls_exceptn.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/tls/tls_exceptn.h b/src/tls/tls_exceptn.h
new file mode 100644
index 000000000..ad19c6c9d
--- /dev/null
+++ b/src/tls/tls_exceptn.h
@@ -0,0 +1,47 @@
+/*
+* Exceptions
+* (C) 2004-2006 Jack Lloyd
+*
+* Released under the terms of the Botan license
+*/
+
+#ifndef BOTAN_TLS_EXCEPTION_H__
+#define BOTAN_TLS_EXCEPTION_H__
+
+#include <botan/exceptn.h>
+#include <botan/tls_alert.h>
+
+namespace Botan {
+
+namespace TLS {
+
+/**
+* Exception Base Class
+*/
+class BOTAN_DLL TLS_Exception : public Exception
+ {
+ public:
+ Alert::Type type() const throw() { return alert_type; }
+
+ TLS_Exception(Alert::Type type,
+ const std::string& err_msg = "Unknown error") :
+ Exception(err_msg), alert_type(type) {}
+
+ private:
+ Alert::Type alert_type;
+ };
+
+/**
+* Unexpected_Message Exception
+*/
+struct BOTAN_DLL Unexpected_Message : public TLS_Exception
+ {
+ Unexpected_Message(const std::string& err) :
+ TLS_Exception(Alert::UNEXPECTED_MESSAGE, err) {}
+ };
+
+}
+
+}
+
+#endif