Skip to content

Commit

Permalink
add parameters for session resuming
Browse files Browse the repository at this point in the history
mostly callbacks during the handshake, and a parameter to enable session usage.
  • Loading branch information
vincenthz committed Dec 20, 2011
1 parent 34b186b commit 83b8607
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Network/TLS/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ data TLSParams = TLSParams
, pWantClientCert :: Bool -- ^ request a certificate from client.
-- use by server only.
, pUseSecureRenegotiation :: Bool -- notify that we want to use secure renegotation
, pUseSession :: Bool -- generate new session if specified
, pCertificates :: [(X509, Maybe PrivateKey)] -- ^ the cert chain for this context with the associated keys if any.
, pLogging :: TLSLogging -- ^ callback for logging
, onHandshake :: Measurement -> IO Bool -- ^ callback on a beggining of handshake
, onCertificatesRecv :: [X509] -> IO TLSCertificateUsage -- ^ callback to verify received cert chain.
, onSessionResumption :: SessionID -> IO (Maybe SessionData) -- ^ callback to maybe resume session on server.
, onSessionEstablished :: SessionID -> SessionData -> IO () -- ^ callback when session have been established
, onSessionInvalidated :: SessionID -> IO () -- ^ callback when session is invalidated by error
, sessionResumeWith :: Maybe (SessionID, SessionData) -- ^ try to establish a connection using this session.
}

defaultLogging :: TLSLogging
Expand All @@ -96,10 +101,15 @@ defaultParams = TLSParams
, pCompressions = [nullCompression]
, pWantClientCert = False
, pUseSecureRenegotiation = True
, pUseSession = True
, pCertificates = []
, pLogging = defaultLogging
, onHandshake = (\_ -> return True)
, onCertificatesRecv = (\_ -> return CertificateUsageAccept)
, onSessionResumption = (\_ -> return Nothing)
, onSessionEstablished = (\_ _ -> return ())
, onSessionInvalidated = (\_ -> return ())
, sessionResumeWith = Nothing
}

instance Show TLSParams where
Expand Down

0 comments on commit 83b8607

Please sign in to comment.