{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE PatternSynonyms #-}
module Network.TLS.Error where
import Control.Exception (Exception (..))
import Data.Typeable
import Network.TLS.Imports
data TLSError
=
Error_Misc String
|
Error_Protocol String AlertDescription
|
Error_Protocol_Warning String AlertDescription
| Error_Certificate String
|
Error_HandshakePolicy String
| Error_EOF
| Error_Packet String
| Error_Packet_unexpected String String
| Error_Packet_Parsing String
| Error_TCP_Terminate
deriving (TLSError -> TLSError -> Bool
(TLSError -> TLSError -> Bool)
-> (TLSError -> TLSError -> Bool) -> Eq TLSError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TLSError -> TLSError -> Bool
== :: TLSError -> TLSError -> Bool
$c/= :: TLSError -> TLSError -> Bool
/= :: TLSError -> TLSError -> Bool
Eq, Int -> TLSError -> ShowS
[TLSError] -> ShowS
TLSError -> String
(Int -> TLSError -> ShowS)
-> (TLSError -> String) -> ([TLSError] -> ShowS) -> Show TLSError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TLSError -> ShowS
showsPrec :: Int -> TLSError -> ShowS
$cshow :: TLSError -> String
show :: TLSError -> String
$cshowList :: [TLSError] -> ShowS
showList :: [TLSError] -> ShowS
Show, Typeable)
data TLSException
=
Terminated Bool String TLSError
|
HandshakeFailed TLSError
|
PostHandshake TLSError
|
Uncontextualized TLSError
|
ConnectionNotEstablished
|
MissingHandshake
deriving (Int -> TLSException -> ShowS
[TLSException] -> ShowS
TLSException -> String
(Int -> TLSException -> ShowS)
-> (TLSException -> String)
-> ([TLSException] -> ShowS)
-> Show TLSException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TLSException -> ShowS
showsPrec :: Int -> TLSException -> ShowS
$cshow :: TLSException -> String
show :: TLSException -> String
$cshowList :: [TLSException] -> ShowS
showList :: [TLSException] -> ShowS
Show, TLSException -> TLSException -> Bool
(TLSException -> TLSException -> Bool)
-> (TLSException -> TLSException -> Bool) -> Eq TLSException
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TLSException -> TLSException -> Bool
== :: TLSException -> TLSException -> Bool
$c/= :: TLSException -> TLSException -> Bool
/= :: TLSException -> TLSException -> Bool
Eq, Typeable)
instance Exception TLSException
newtype AlertLevel = AlertLevel {AlertLevel -> Word8
fromAlertLevel :: Word8} deriving (AlertLevel -> AlertLevel -> Bool
(AlertLevel -> AlertLevel -> Bool)
-> (AlertLevel -> AlertLevel -> Bool) -> Eq AlertLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AlertLevel -> AlertLevel -> Bool
== :: AlertLevel -> AlertLevel -> Bool
$c/= :: AlertLevel -> AlertLevel -> Bool
/= :: AlertLevel -> AlertLevel -> Bool
Eq)
pattern AlertLevel_Warning :: AlertLevel
pattern $bAlertLevel_Warning :: AlertLevel
$mAlertLevel_Warning :: forall {r}. AlertLevel -> ((# #) -> r) -> ((# #) -> r) -> r
AlertLevel_Warning = AlertLevel 1
pattern AlertLevel_Fatal :: AlertLevel
pattern $bAlertLevel_Fatal :: AlertLevel
$mAlertLevel_Fatal :: forall {r}. AlertLevel -> ((# #) -> r) -> ((# #) -> r) -> r
AlertLevel_Fatal = AlertLevel 2
instance Show AlertLevel where
show :: AlertLevel -> String
show AlertLevel
AlertLevel_Warning = String
"AlertLevel_Warning"
show AlertLevel
AlertLevel_Fatal = String
"AlertLevel_Fatal"
show (AlertLevel Word8
x) = String
"AlertLevel " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show Word8
x
newtype AlertDescription = AlertDescription {AlertDescription -> Word8
fromAlertDescription :: Word8}
deriving (AlertDescription -> AlertDescription -> Bool
(AlertDescription -> AlertDescription -> Bool)
-> (AlertDescription -> AlertDescription -> Bool)
-> Eq AlertDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AlertDescription -> AlertDescription -> Bool
== :: AlertDescription -> AlertDescription -> Bool
$c/= :: AlertDescription -> AlertDescription -> Bool
/= :: AlertDescription -> AlertDescription -> Bool
Eq)
pattern CloseNotify :: AlertDescription
pattern $bCloseNotify :: AlertDescription
$mCloseNotify :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
CloseNotify = AlertDescription 0
pattern UnexpectedMessage :: AlertDescription
pattern $bUnexpectedMessage :: AlertDescription
$mUnexpectedMessage :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
UnexpectedMessage = AlertDescription 10
pattern BadRecordMac :: AlertDescription
pattern $bBadRecordMac :: AlertDescription
$mBadRecordMac :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
BadRecordMac = AlertDescription 20
pattern DecryptionFailed :: AlertDescription
pattern $bDecryptionFailed :: AlertDescription
$mDecryptionFailed :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
DecryptionFailed = AlertDescription 21
pattern RecordOverflow :: AlertDescription
pattern $bRecordOverflow :: AlertDescription
$mRecordOverflow :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
RecordOverflow = AlertDescription 22
pattern DecompressionFailure :: AlertDescription
pattern $bDecompressionFailure :: AlertDescription
$mDecompressionFailure :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
DecompressionFailure = AlertDescription 30
pattern HandshakeFailure :: AlertDescription
pattern $bHandshakeFailure :: AlertDescription
$mHandshakeFailure :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
HandshakeFailure = AlertDescription 40
pattern BadCertificate :: AlertDescription
pattern $bBadCertificate :: AlertDescription
$mBadCertificate :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
BadCertificate = AlertDescription 42
pattern UnsupportedCertificate :: AlertDescription
pattern $bUnsupportedCertificate :: AlertDescription
$mUnsupportedCertificate :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
UnsupportedCertificate = AlertDescription 43
pattern CertificateRevoked :: AlertDescription
pattern $bCertificateRevoked :: AlertDescription
$mCertificateRevoked :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
CertificateRevoked = AlertDescription 44
pattern CertificateExpired :: AlertDescription
pattern $bCertificateExpired :: AlertDescription
$mCertificateExpired :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
CertificateExpired = AlertDescription 45
pattern CertificateUnknown :: AlertDescription
pattern $bCertificateUnknown :: AlertDescription
$mCertificateUnknown :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
CertificateUnknown = AlertDescription 46
pattern IllegalParameter :: AlertDescription
pattern $bIllegalParameter :: AlertDescription
$mIllegalParameter :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
IllegalParameter = AlertDescription 47
pattern UnknownCa :: AlertDescription
pattern $bUnknownCa :: AlertDescription
$mUnknownCa :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
UnknownCa = AlertDescription 48
pattern AccessDenied :: AlertDescription
pattern $bAccessDenied :: AlertDescription
$mAccessDenied :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
AccessDenied = AlertDescription 49
pattern DecodeError :: AlertDescription
pattern $bDecodeError :: AlertDescription
$mDecodeError :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
DecodeError = AlertDescription 50
pattern DecryptError :: AlertDescription
pattern $bDecryptError :: AlertDescription
$mDecryptError :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
DecryptError = AlertDescription 51
pattern ExportRestriction :: AlertDescription
pattern $bExportRestriction :: AlertDescription
$mExportRestriction :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
ExportRestriction = AlertDescription 60
pattern ProtocolVersion :: AlertDescription
pattern $bProtocolVersion :: AlertDescription
$mProtocolVersion :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
ProtocolVersion = AlertDescription 70
pattern InsufficientSecurity :: AlertDescription
pattern $bInsufficientSecurity :: AlertDescription
$mInsufficientSecurity :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
InsufficientSecurity = AlertDescription 71
pattern InternalError :: AlertDescription
pattern $bInternalError :: AlertDescription
$mInternalError :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
InternalError = AlertDescription 80
pattern InappropriateFallback :: AlertDescription
pattern $bInappropriateFallback :: AlertDescription
$mInappropriateFallback :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
InappropriateFallback = AlertDescription 86
pattern UserCanceled :: AlertDescription
pattern $bUserCanceled :: AlertDescription
$mUserCanceled :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
UserCanceled = AlertDescription 90
pattern NoRenegotiation :: AlertDescription
pattern $bNoRenegotiation :: AlertDescription
$mNoRenegotiation :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
NoRenegotiation = AlertDescription 100
pattern MissingExtension :: AlertDescription
pattern $bMissingExtension :: AlertDescription
$mMissingExtension :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
MissingExtension = AlertDescription 109
pattern UnsupportedExtension :: AlertDescription
pattern $bUnsupportedExtension :: AlertDescription
$mUnsupportedExtension :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
UnsupportedExtension = AlertDescription 110
pattern CertificateUnobtainable :: AlertDescription
pattern $bCertificateUnobtainable :: AlertDescription
$mCertificateUnobtainable :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
CertificateUnobtainable = AlertDescription 111
pattern UnrecognizedName :: AlertDescription
pattern $bUnrecognizedName :: AlertDescription
$mUnrecognizedName :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
UnrecognizedName = AlertDescription 112
pattern BadCertificateStatusResponse :: AlertDescription
pattern $bBadCertificateStatusResponse :: AlertDescription
$mBadCertificateStatusResponse :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
BadCertificateStatusResponse = AlertDescription 113
pattern BadCertificateHashValue :: AlertDescription
pattern $bBadCertificateHashValue :: AlertDescription
$mBadCertificateHashValue :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
BadCertificateHashValue = AlertDescription 114
pattern UnknownPskIdentity :: AlertDescription
pattern $bUnknownPskIdentity :: AlertDescription
$mUnknownPskIdentity :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
UnknownPskIdentity = AlertDescription 115
pattern CertificateRequired :: AlertDescription
pattern $bCertificateRequired :: AlertDescription
$mCertificateRequired :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
CertificateRequired = AlertDescription 116
pattern GeneralError :: AlertDescription
pattern $bGeneralError :: AlertDescription
$mGeneralError :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
GeneralError = AlertDescription 117
pattern NoApplicationProtocol :: AlertDescription
pattern $bNoApplicationProtocol :: AlertDescription
$mNoApplicationProtocol :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
NoApplicationProtocol = AlertDescription 120
pattern EchRequired :: AlertDescription
pattern $bEchRequired :: AlertDescription
$mEchRequired :: forall {r}. AlertDescription -> ((# #) -> r) -> ((# #) -> r) -> r
EchRequired = AlertDescription 121
instance Show AlertDescription where
show :: AlertDescription -> String
show AlertDescription
CloseNotify = String
"CloseNotify"
show AlertDescription
UnexpectedMessage = String
"UnexpectedMessage"
show AlertDescription
BadRecordMac = String
"BadRecordMac"
show AlertDescription
DecryptionFailed = String
"DecryptionFailed"
show AlertDescription
RecordOverflow = String
"RecordOverflow"
show AlertDescription
DecompressionFailure = String
"DecompressionFailure"
show AlertDescription
HandshakeFailure = String
"HandshakeFailure"
show AlertDescription
BadCertificate = String
"BadCertificate"
show AlertDescription
UnsupportedCertificate = String
"UnsupportedCertificate"
show AlertDescription
CertificateRevoked = String
"CertificateRevoked"
show AlertDescription
CertificateExpired = String
"CertificateExpired"
show AlertDescription
CertificateUnknown = String
"CertificateUnknown"
show AlertDescription
IllegalParameter = String
"IllegalParameter"
show AlertDescription
UnknownCa = String
"UnknownCa"
show AlertDescription
AccessDenied = String
"AccessDenied"
show AlertDescription
DecodeError = String
"DecodeError"
show AlertDescription
DecryptError = String
"DecryptError"
show AlertDescription
ExportRestriction = String
"ExportRestriction"
show AlertDescription
ProtocolVersion = String
"ProtocolVersion"
show AlertDescription
InsufficientSecurity = String
"InsufficientSecurity"
show AlertDescription
InternalError = String
"InternalError"
show AlertDescription
InappropriateFallback = String
"InappropriateFallback"
show AlertDescription
UserCanceled = String
"UserCanceled"
show AlertDescription
NoRenegotiation = String
"NoRenegotiation"
show AlertDescription
MissingExtension = String
"MissingExtension"
show AlertDescription
UnsupportedExtension = String
"UnsupportedExtension"
show AlertDescription
CertificateUnobtainable = String
"CertificateUnobtainable"
show AlertDescription
UnrecognizedName = String
"UnrecognizedName"
show AlertDescription
BadCertificateStatusResponse = String
"BadCertificateStatusResponse"
show AlertDescription
BadCertificateHashValue = String
"BadCertificateHashValue"
show AlertDescription
UnknownPskIdentity = String
"UnknownPskIdentity"
show AlertDescription
CertificateRequired = String
"CertificateRequired"
show AlertDescription
GeneralError = String
"GeneralError"
show AlertDescription
NoApplicationProtocol = String
"NoApplicationProtocol"
show AlertDescription
EchRequired = String
"EchRequired"
show (AlertDescription Word8
x) = String
"AlertDescription " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show Word8
x