Safe Haskell | None |
---|---|
Language | Haskell2010 |
API for running
Handshake
protocol.
Synopsis
- runHandshakeClient :: ( MonadAsync m, MonadFork m, MonadMonotonicTime m, MonadTimer m, MonadMask m, MonadThrow ( STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m ( Either ( HandshakeException vNumber) (application, vNumber, vData))
- runHandshakeServer :: ( MonadAsync m, MonadFork m, MonadMonotonicTime m, MonadTimer m, MonadMask m, MonadThrow ( STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m ( Either ( HandshakeException vNumber) (application, vNumber, vData))
-
data
HandshakeArguments
connectionId vNumber vData m =
HandshakeArguments
{
- haHandshakeTracer :: Tracer m ( WithMuxBearer connectionId ( TraceSendRecv ( Handshake vNumber Term )))
- haHandshakeCodec :: Codec ( Handshake vNumber Term ) DeserialiseFailure m ByteString
- haVersionDataCodec :: VersionDataCodec Term vNumber vData
- haAcceptVersion :: vData -> vData -> Accept vData
- haTimeLimits :: ProtocolTimeLimits ( Handshake vNumber Term )
-
newtype
Versions
vNum vData r =
Versions
{
- getVersions :: Map vNum ( Version vData r)
- data HandshakeException vNumber
-
data
HandshakeProtocolError
vNumber
- = HandshakeError ( RefuseReason vNumber)
- | NotRecognisedVersion vNumber
- | InvalidServerSelection vNumber Text
-
data
RefuseReason
vNumber
- = VersionMismatch [vNumber] [ Int ]
- | HandshakeDecodeError vNumber Text
- | Refused vNumber Text
- data Accept vData
Documentation
runHandshakeClient :: ( MonadAsync m, MonadFork m, MonadMonotonicTime m, MonadTimer m, MonadMask m, MonadThrow ( STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m ( Either ( HandshakeException vNumber) (application, vNumber, vData)) Source #
Run client side of the
Handshake
protocol
runHandshakeServer :: ( MonadAsync m, MonadFork m, MonadMonotonicTime m, MonadTimer m, MonadMask m, MonadThrow ( STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m ( Either ( HandshakeException vNumber) (application, vNumber, vData)) Source #
Run server side of the
Handshake
protocol.
data HandshakeArguments connectionId vNumber vData m Source #
Common arguments for both
Handshake
client & server.
HandshakeArguments | |
|
newtype Versions vNum vData r Source #
The version map supported by the local agent keyed on the version identifier.
Each
Version
contains a function which takes negotiated version data and
returns negotiated application (the
r
type variable).
If one needs to combine multiple versions the simplest way is to use one of
the combinators:
foldMapVersions
,
combineVersions
or the
Semigroup
instance directly:
fold $ (simpleSingletonVersions ...) :| [ (simpleSingletonVersions ...) , (simpleSingletonVersions ...) , ... ]
Versions | |
|
data HandshakeException vNumber Source #
Wrapper around initiator and responder errors experienced by tryHandshake.
HandshakeProtocolLimit ProtocolLimitFailure | |
HandshakeProtocolError ( HandshakeProtocolError vNumber) |
Instances
Show vNumber => Show ( HandshakeException vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake |
data HandshakeProtocolError vNumber Source #
Extends handshake error
type, by client specific errors.
RefuseReason
HandshakeError ( RefuseReason vNumber) | |
NotRecognisedVersion vNumber | |
InvalidServerSelection vNumber Text |
Instances
Eq vNumber => Eq ( HandshakeProtocolError vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type (==) :: HandshakeProtocolError vNumber -> HandshakeProtocolError vNumber -> Bool Source # (/=) :: HandshakeProtocolError vNumber -> HandshakeProtocolError vNumber -> Bool Source # |
|
Show vNumber => Show ( HandshakeProtocolError vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type |
|
( Typeable vNumber, Show vNumber) => Exception ( HandshakeProtocolError vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type toException :: HandshakeProtocolError vNumber -> SomeException Source # fromException :: SomeException -> Maybe ( HandshakeProtocolError vNumber) Source # displayException :: HandshakeProtocolError vNumber -> String Source # |
data RefuseReason vNumber Source #
Reasons by which a server can refuse proposed version.
VersionMismatch [vNumber] [ Int ] |
All of the prosed versions where not known to the server.
Since the server sends all versions that it can knows about, some of them
we might not be able to decode, so we include raw tags
|
HandshakeDecodeError vNumber Text |
The server failed to decode version parameters. |
Refused vNumber Text |
The server refused to run the proposed version parameters |
Instances
Eq vNumber => Eq ( RefuseReason vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type (==) :: RefuseReason vNumber -> RefuseReason vNumber -> Bool Source # (/=) :: RefuseReason vNumber -> RefuseReason vNumber -> Bool Source # |
|
Show vNumber => Show ( RefuseReason vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type |
|
( Typeable vNumber, Show vNumber) => Exception ( RefuseReason vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type toException :: RefuseReason vNumber -> SomeException Source # fromException :: SomeException -> Maybe ( RefuseReason vNumber) Source # displayException :: RefuseReason vNumber -> String Source # |