module Network.TLS.Handshake
    ( handshake
    , handshakeWith
    , handshakeClientWith
    , handshakeServerWith
    , handshakeClient
    , handshakeServer
    ) where
import Network.TLS.Context.Internal
import Network.TLS.Struct
import Network.TLS.Handshake.Common
import Network.TLS.Handshake.Client
import Network.TLS.Handshake.Server
import Control.Monad.State.Strict
handshake :: MonadIO m => Context -> m ()
handshake ctx =
    liftIO $ withRWLock ctx $ handleException ctx (ctxDoHandshake ctx ctx)
handshakeWith :: MonadIO m => Context -> Handshake -> m ()
handshakeWith ctx hs =
    liftIO $ withWriteLock ctx $ handleException ctx $ ctxDoHandshakeWith ctx ctx hs