module Network.TLS.Hooks
( Logging(..)
, Hooks(..)
, defaultHooks
) where
import qualified Data.ByteString as B
import Network.TLS.Struct (Header, Handshake)
import Network.TLS.Struct13 (Handshake13)
import Network.TLS.X509 (CertificateChain)
import Data.Default.Class
data Logging = Logging
{ Logging -> String -> IO ()
loggingPacketSent :: String -> IO ()
, Logging -> String -> IO ()
loggingPacketRecv :: String -> IO ()
, Logging -> ByteString -> IO ()
loggingIOSent :: B.ByteString -> IO ()
, Logging -> Header -> ByteString -> IO ()
loggingIORecv :: Header -> B.ByteString -> IO ()
}
defaultLogging :: Logging
defaultLogging :: Logging
defaultLogging = Logging
{ loggingPacketSent :: String -> IO ()
loggingPacketSent = \String
_ -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
, loggingPacketRecv :: String -> IO ()
loggingPacketRecv = \String
_ -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
, loggingIOSent :: ByteString -> IO ()
loggingIOSent = \ByteString
_ -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
, loggingIORecv :: Header -> ByteString -> IO ()
loggingIORecv = \Header
_ ByteString
_ -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
}
instance Default Logging where
def :: Logging
def = Logging
defaultLogging
data Hooks = Hooks
{
Hooks -> Handshake -> IO Handshake
hookRecvHandshake :: Handshake -> IO Handshake
, Hooks -> Handshake13 -> IO Handshake13
hookRecvHandshake13 :: Handshake13 -> IO Handshake13
, Hooks -> CertificateChain -> IO ()
hookRecvCertificates :: CertificateChain -> IO ()
, Hooks -> Logging
hookLogging :: Logging
}
defaultHooks :: Hooks
defaultHooks :: Hooks
defaultHooks = Hooks
{ hookRecvHandshake :: Handshake -> IO Handshake
hookRecvHandshake = forall (m :: * -> *) a. Monad m => a -> m a
return
, hookRecvHandshake13 :: Handshake13 -> IO Handshake13
hookRecvHandshake13 = forall (m :: * -> *) a. Monad m => a -> m a
return
, hookRecvCertificates :: CertificateChain -> IO ()
hookRecvCertificates = forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> b -> a
const ()
, hookLogging :: Logging
hookLogging = forall a. Default a => a
def
}
instance Default Hooks where
def :: Hooks
def = Hooks
defaultHooks