aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls/tls_exceptn.h
blob: 1b58e1bebc0252e0aa07642082d43e0e56dc2366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Exceptions
* (C) 2004-2006 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#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_PUBLIC_API(2,0) TLS_Exception : public Exception
   {
   public:
      Alert::Type type() const { return m_alert_type; }

      TLS_Exception(Alert::Type type,
                    const std::string& err_msg = "Unknown error") :
         Exception(err_msg), m_alert_type(type) {}

   private:
      Alert::Type m_alert_type;
   };

/**
* Unexpected_Message Exception
*/
struct BOTAN_PUBLIC_API(2,0) Unexpected_Message final : public TLS_Exception
   {
   explicit Unexpected_Message(const std::string& err) :
      TLS_Exception(Alert::UNEXPECTED_MESSAGE, err) {}
   };

}

}

#endif