module Network.TLS.Types
( Version(..)
, SessionID
, SessionData(..)
, CipherID
, CompressionID
, Role(..)
, invertRole
, Direction(..)
) where
import Network.TLS.Imports
type HostName = String
data Version = SSL2 | SSL3 | TLS10 | TLS11 | TLS12 deriving (Show, Eq, Ord, Bounded)
type SessionID = ByteString
data SessionData = SessionData
{ sessionVersion :: Version
, sessionCipher :: CipherID
, sessionCompression :: CompressionID
, sessionClientSNI :: Maybe HostName
, sessionSecret :: ByteString
} deriving (Show,Eq)
type CipherID = Word16
type CompressionID = Word8
data Role = ClientRole | ServerRole
deriving (Show,Eq)
data Direction = Tx | Rx
deriving (Show,Eq)
invertRole :: Role -> Role
invertRole ClientRole = ServerRole
invertRole ServerRole = ClientRole