Botan
1.11.15
|
00001 /* 00002 * Exceptions 00003 * (C) 2004-2006 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_TLS_EXCEPTION_H__ 00009 #define BOTAN_TLS_EXCEPTION_H__ 00010 00011 #include <botan/exceptn.h> 00012 #include <botan/tls_alert.h> 00013 00014 namespace Botan { 00015 00016 namespace TLS { 00017 00018 /** 00019 * Exception Base Class 00020 */ 00021 class BOTAN_DLL TLS_Exception : public Exception 00022 { 00023 public: 00024 Alert::Type type() const { return m_alert_type; } 00025 00026 TLS_Exception(Alert::Type type, 00027 const std::string& err_msg = "Unknown error") : 00028 Exception(err_msg), m_alert_type(type) {} 00029 00030 private: 00031 Alert::Type m_alert_type; 00032 }; 00033 00034 /** 00035 * Unexpected_Message Exception 00036 */ 00037 struct BOTAN_DLL Unexpected_Message : public TLS_Exception 00038 { 00039 Unexpected_Message(const std::string& err) : 00040 TLS_Exception(Alert::UNEXPECTED_MESSAGE, err) {} 00041 }; 00042 00043 } 00044 00045 } 00046 00047 #endif