Botan 2.19.5 Crypto and TLS for C&

tls_exceptn.h
Go to the documentation of this file.
1/*
2* Exceptions
3* (C) 2004-2006 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_TLS_EXCEPTION_H_
9#define BOTAN_TLS_EXCEPTION_H_
10
11#include <botan/exceptn.h>
12#include <botan/tls_alert.h>
13
14 namespace Botan {
15
16 namespace TLS {
17
18/**
19* TLS Exception Base Class
20*/
21 class BOTAN_PUBLIC_API(2,0) TLS_Exception : public Exception
22 {
23 public:
24 Alert::Type type() const { return m_alert_type; }
25
26 TLS_Exception(Alert::Type type,
27 const std::string& err_msg = "Unknown error") :
28 Exception(err_msg), m_alert_type(type) {}
29
30 int error_code() const noexcept override { return static_cast<int>(m_alert_type); }
31
32 ErrorType error_type() const noexcept override { return ErrorType::TLSError; }
33
34 private:
35 Alert::Type m_alert_type;
36 };
37
38/**
39* Unexpected_Message Exception
40*/
41 class BOTAN_PUBLIC_API(2,0) Unexpected_Message final : public TLS_Exception
42 {
43 public:
44 explicit Unexpected_Message(const std::string& err) :
45 TLS_Exception(Alert::UNEXPECTED_MESSAGE, err) {}
46 };
47
48}
49
50}
51
52#endif
Botan::Exception
Definition: exceptn.h:86
Botan::TLS::Alert
Definition: tls_alert.h:22
Botan::TLS::Alert::Type
Type
Definition: tls_alert.h:27
Botan::TLS::TLS_Exception
Definition: tls_exceptn.h:22
Botan::TLS::TLS_Exception::type
Alert::Type type() const
Definition: tls_exceptn.h:24
Botan::TLS::TLS_Exception::error_type
ErrorType error_type() const noexcept override
Definition: tls_exceptn.h:32
Botan::TLS::TLS_Exception::error_code
int error_code() const noexcept override
Definition: tls_exceptn.h:30
Botan::TLS::TLS_Exception::TLS_Exception
TLS_Exception(Alert::Type type, const std::string &err_msg="Unknown error")
Definition: tls_exceptn.h:26
Botan::TLS::Unexpected_Message
Definition: tls_exceptn.h:42
Botan::TLS::Unexpected_Message::Unexpected_Message
Unexpected_Message(const std::string &err)
Definition: tls_exceptn.h:44
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan
Definition: alg_id.cpp:13
Botan::ErrorType
ErrorType
Definition: exceptn.h:20
Botan::ErrorType::TLSError
@ TLSError
type
MechanismType type
Definition: p11_mechanism.cpp:44